Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regressors are linearly dependent #2

Closed
ygor opened this issue Mar 28, 2011 · 5 comments
Closed

Regressors are linearly dependent #2

ygor opened this issue Mar 28, 2011 · 5 comments

Comments

@ygor
Copy link

ygor commented Mar 28, 2011

With the following code, i get an error "matrixengine.rb:56:in `initialize': Regressors are linearly dependent (Statsample::Regression::LinearDependency)":

ds = Statsample::Dataset.new({
'a' => [5,5,4,5,5,2,2,4].to_scale,
'b' => [5,2,5,2,5,1,1,4].to_scale,
'c' => [4,5,2,4,5,2,1,4].to_scale,
'd' => [4,5,5,5,5,5,1,5].to_scale,
'e' => [5,4,1,5,1,5,4,2].to_scale,
'f' => [4,5,4,5,5,1,1,5].to_scale,
'g' => [4,2,4,4,5,5,4,1].to_scale,
'h' => [4,1,5,5,5,1,4,5].to_scale,
'i' => [4,2,2,1,4,5,5,5].to_scale
})

lr = Statsample::Regression.multiple(ds, 'a')
puts lr.summary

Any idea what is going on? (Excel does provide a linear regression)

@clbustos
Copy link
Owner

Ygor:

On matrixengine I test if determinant of correlation matrix is 0 or near to
it. The easy way to override this behaviour is comment out the line 56 on
matrixengine.rb. I will test the engine with your data, anyway.

On Mon, Mar 28, 2011 at 9:40 AM, Ygor <
[email protected]>wrote:

With the following code, i get an error "matrixengine.rb:56:in
`initialize': Regressors are linearly dependent
(Statsample::Regression::LinearDependency)":

ds = Statsample::Dataset.new({
'a' => [5,5,4,5,5,2,2,4].to_scale,
'b' => [5,2,5,2,5,1,1,4].to_scale,
'c' => [4,5,2,4,5,2,1,4].to_scale,
'd' => [4,5,5,5,5,5,1,5].to_scale,
'e' => [5,4,1,5,1,5,4,2].to_scale,
'f' => [4,5,4,5,5,1,1,5].to_scale,
'g' => [4,2,4,4,5,5,4,1].to_scale,
'h' => [4,1,5,5,5,1,4,5].to_scale,
'i' => [4,2,2,1,4,5,5,5].to_scale
})

lr = Statsample::Regression.multiple(ds, 'a')
puts lr.summary

Any idea what is going on? (Excel does provide a linear regression)

Reply to this email directly or view it on GitHub:
#2

Claudio Bustos
Psiclogo
[email protected]

@ygor
Copy link
Author

ygor commented Mar 30, 2011

If i comment out the line on 56, it goes wrong a bit further. It appears it cannot perform a linear regression. Any idea why excel can do it?

@clbustos
Copy link
Owner

clbustos commented Apr 3, 2011

On R appears the same problem. The predictors are linearly dependent between them, so R^2 is 1.
So, is an Excel problem not warning about problem in your data...

@clbustos clbustos closed this as completed Apr 3, 2011
@ygor
Copy link
Author

ygor commented Apr 3, 2011

Ok, thnx a lot for looking into this!

@clbustos
Copy link
Owner

clbustos commented Apr 5, 2011

No problem at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants