# Module: Statsample::Shorthand

Included in:
Analysis::Suite
Defined in:
lib/statsample/shorthand.rb

## Overview

Module which provide shorthands for many methods.

## Class Method Summary collapse

• Random generation for the normal distribution.

## Instance Method Summary collapse

• Returns a Statsample::Graph::Boxplot.

• Create a correlation matrix from a dataset.

• Create a variance/covariance matrix from a dataset.

• #dataset(vectors = Hash.new) ⇒ Object (also: #data_frame)

Creates a new Daru::DataFrame Each key is transformed into a Symbol wherever possible.

• Returns a Statsample::Graph::Histogram.

• Returns a Statsample::Test::Levene.

• Other Shortcuts.

• Retrieve names (fields) from dataset.

• Import an CSV file.

• Import an Excel file.

• Returns a Statsample::Graph::Scatterplot.

• Create a Daru::Vector Analog to R's c.

## Class Method Details

### .rnorm(n, mean = 0, sd = 1) ⇒ Object

Random generation for the normal distribution

 ``` 43 44 45 46``` ```# File 'lib/statsample/shorthand.rb', line 43 def rnorm(n,mean=0,sd=1) rng=Distribution::Normal.rng(mean,sd) Daru::Vector.new_with_size(n) { rng.call} end```

### .test_u(*args) ⇒ Object

 ``` 119 120 121``` ```# File 'lib/statsample/shorthand.rb', line 119 def test_u(*args) Statsample::Test::UMannWhitney.new(*args) end```

## Instance Method Details

### #boxplot(*args) ⇒ Object

Returns a Statsample::Graph::Boxplot

 ``` 59 60 61``` ```# File 'lib/statsample/shorthand.rb', line 59 def boxplot(*args) Statsample::Graph::Boxplot.new(*args) end```

### #cor(ds) ⇒ Object

Create a correlation matrix from a dataset

 ``` 30 31 32``` ```# File 'lib/statsample/shorthand.rb', line 30 def cor(ds) Statsample::Bivariate.correlation_matrix(ds) end```

### #cov(ds) ⇒ Object

Create a variance/covariance matrix from a dataset

 ``` 34 35 36``` ```# File 'lib/statsample/shorthand.rb', line 34 def cov(ds) Statsample::Bivariate.covariate_matrix(ds) end```

### #dataset(vectors = Hash.new) ⇒ ObjectAlso known as: data_frame

Creates a new Daru::DataFrame Each key is transformed into a Symbol wherever possible.

 ``` 49 50 51 52 53 54 55 56``` ```# File 'lib/statsample/shorthand.rb', line 49 def dataset(vectors=Hash.new) vectors = vectors.inject({}) do |ac,v| n = v[0].respond_to?(:to_sym) ? v[0].to_sym : v[0] ac[n] = v[1] ac end Daru::DataFrame.new(vectors) end```

### #dominance_analysis(*args) ⇒ Object

 ``` 99 100 101``` ```# File 'lib/statsample/shorthand.rb', line 99 def dominance_analysis(*args) Statsample::DominanceAnalysis.new(*args) end```

### #dominance_analysis_bootstrap(*args) ⇒ Object

 ``` 103 104 105``` ```# File 'lib/statsample/shorthand.rb', line 103 def dominance_analysis_bootstrap(*args) Statsample::DominanceAnalysis::Bootstrap.new(*args) end```

### #histogram(*args) ⇒ Object

Returns a Statsample::Graph::Histogram

 ``` 63 64 65``` ```# File 'lib/statsample/shorthand.rb', line 63 def histogram(*args) Statsample::Graph::Histogram.new(*args) end```

### #levene(*args) ⇒ Object

Returns a Statsample::Test::Levene

 ``` 72 73 74``` ```# File 'lib/statsample/shorthand.rb', line 72 def levene(*args) Statsample::Test::Levene.new(*args) end```

### #lr(*args) ⇒ Object

Other Shortcuts

 ``` 91 92 93``` ```# File 'lib/statsample/shorthand.rb', line 91 def lr(*args) Statsample::Regression.multiple(*args) end```

### #multiscale_analysis(*args, &block) ⇒ Object

 ``` 115 116 117``` ```# File 'lib/statsample/shorthand.rb', line 115 def multiscale_analysis(*args,&block) Statsample::Reliability::MultiScaleAnalysis.new(*args,&block) end```

### #names(ds) ⇒ Object

Retrieve names (fields) from dataset

 ``` 26 27 28``` ```# File 'lib/statsample/shorthand.rb', line 26 def names(ds) ds.vectors.to_a end```

### #pca(ds, opts = Hash.new) ⇒ Object

 ``` 95 96 97``` ```# File 'lib/statsample/shorthand.rb', line 95 def pca(ds,opts=Hash.new) Statsample::Factor::PCA.new(ds,opts) end```

### #polychoric(*args) ⇒ Object

 ``` 80 81 82``` ```# File 'lib/statsample/shorthand.rb', line 80 def polychoric(*args) Statsample::Bivariate::Polychoric.new(*args) end```

### #principal_axis(*args) ⇒ Object

 ``` 76 77 78``` ```# File 'lib/statsample/shorthand.rb', line 76 def principal_axis(*args) Statsample::Factor::PrincipalAxis.new(*args) end```

### #read_csv(filename, opts = Hash.new) ⇒ Object

Import an CSV file. Cache result by default

 ``` 21 22 23``` ```# File 'lib/statsample/shorthand.rb', line 21 def read_csv(filename, opts=Hash.new) Daru::DataFrame.from_csv filename, opts end```

### #read_excel(filename, opts = Hash.new) ⇒ Object

Import an Excel file. Cache result by default

 ``` 16 17 18``` ```# File 'lib/statsample/shorthand.rb', line 16 def read_excel(filename, opts=Hash.new) Daru::DataFrame.from_excel filename, opts end```

### #scale_analysis(*args) ⇒ Object

 ``` 107 108 109``` ```# File 'lib/statsample/shorthand.rb', line 107 def scale_analysis(*args) Statsample::Reliability::ScaleAnalysis.new(*args) end```

### #scatterplot(*args) ⇒ Object

Returns a Statsample::Graph::Scatterplot

 ``` 68 69 70``` ```# File 'lib/statsample/shorthand.rb', line 68 def scatterplot(*args) Statsample::Graph::Scatterplot.new(*args) end```

### #skill_scale_analysis(*args) ⇒ Object

 ``` 111 112 113``` ```# File 'lib/statsample/shorthand.rb', line 111 def skill_scale_analysis(*args) Statsample::Reliability::SkillScaleAnalysis.new(*args) end```

### #tetrachoric(*args) ⇒ Object

 ``` 84 85 86``` ```# File 'lib/statsample/shorthand.rb', line 84 def tetrachoric(*args) Statsample::Bivariate::Tetrachoric.new(*args) end```

### #vector(*args) ⇒ Object

Create a Daru::Vector Analog to R's c

 ``` 39 40 41``` ```# File 'lib/statsample/shorthand.rb', line 39 def vector(*args) Daru::Vector[*args] end```