Class: Statsample::Regression::Multiple::MultipleDependent
- Defined in:
- lib/statsample/regression/multiple.rb
Instance Method Summary collapse
-
#initialize(matrix, y_var, opts = Hash.new) ⇒ MultipleDependent
constructor
A new instance of MultipleDependent.
- #p2yx ⇒ Object
- #r2yx ⇒ Object
- #r2yx_covariance ⇒ Object
- #significance ⇒ Object
-
#syyx ⇒ Object
Residual covariance of Y after accountin with lineal relation with x.
- #vxy ⇒ Object
Constructor Details
#initialize(matrix, y_var, opts = Hash.new) ⇒ MultipleDependent
Returns a new instance of MultipleDependent.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/statsample/regression/multiple.rb', line 53 def initialize(matrix,y_var, opts=Hash.new) matrix.extend Statsample::CovariateMatrix @matrix=matrix @fields=matrix.fields - y_var @y_var = y_var @q=@y_var.size @matrix_cor=matrix.correlation @matrix_cor_xx = @matrix_cor.submatrix(@fields) @matrix_cor_yy = @matrix_cor.submatrix(y_var, y_var) @sxx = @matrix.submatrix(@fields) @syy = @matrix.submatrix(y_var, y_var) @sxy = @matrix.submatrix(@fields, y_var) @syx = @sxy.t end |
Instance Method Details
#p2yx ⇒ Object
83 84 85 |
# File 'lib/statsample/regression/multiple.rb', line 83 def p2yx vxy.quo(@q) end |
#r2yx ⇒ Object
69 70 71 |
# File 'lib/statsample/regression/multiple.rb', line 69 def r2yx 1- (@matrix_cor.determinant.quo(@matrix_cor_yy.determinant * @matrix_cor_xx.determinant)) end |
#r2yx_covariance ⇒ Object
76 77 78 |
# File 'lib/statsample/regression/multiple.rb', line 76 def r2yx_covariance 1-(syyx.determinant.quo(@syy.determinant)) end |
#significance ⇒ Object
50 51 52 |
# File 'lib/statsample/regression/multiple.rb', line 50 def significance 0.0 end |
#syyx ⇒ Object
Residual covariance of Y after accountin with lineal relation with x
73 74 75 |
# File 'lib/statsample/regression/multiple.rb', line 73 def syyx @syy-@syx*@sxx.inverse*@sxy end |
#vxy ⇒ Object
80 81 82 |
# File 'lib/statsample/regression/multiple.rb', line 80 def vxy @q-(@syy.inverse*syyx).trace end |