Hi,
I am trying to perform multiple regression in python using rpy.
I can get it to work for two arrays, however when I try to regress a matrix and an array (as in the following code) I get an error message (below.)
Can someone please help?
Thanks,
Ondrej
I am trying to perform multiple regression in python using rpy.
I can get it to work for two arrays, however when I try to regress a matrix and an array (as in the following code) I get an error message (below.)
Can someone please help?
Thanks,
Ondrej
Code:
from rpy import *
phenotypes = array([4,5,4,3])
X = array([1,2,3,4],[3,2,4,5],[6,5,4,3])
d = r.data_frame(x=X, y=phenotypes)
model = r("y~x")
set_default_mode(NO_CONVERSION)
linear_model = r.lm(model, data = d)
set_default_mode(BASIC_CONVERSION)
print r.summary(linear_model)
Traceback (most recent call last):
File "genback.py", line 242, in ?
linear_model = r.lm(model, data = d)
rpy.RException: Error in eval(expr, envir, enclos) : object "x" not found
Comment