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 - 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
1 2536
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 - 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
I don't use that package, but one thing stands out: -
d = r.data_frame(x=X, y=phenotypes)
Ok; get d from the object r's data_frame() method.
? What does r do when called instead of using an access method? - linear_model = r.lm(model, data = d)
Ok; get linear_model from the object r's lm() method.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Michael van der Veeke |
last post by:
Hi All,
Does anyone use any regression testing tools with MS Access? We have tried a
few and none seem to work very well with a MS Access Front end and I need
one. Can anyone provide any...
|
by: nikie |
last post by:
I'm a little bit stuck with NumPy here, and neither the docs nor
trial&error seems to lead me anywhere:
I've got a set of data points (x/y-coordinates) and want to fit a
straight line through...
|
by: sql guy123 |
last post by:
This is a real challenge. I hope someone is smart enough to know how
to do this.
I have a table
TABLE1
|
by: wirecom |
last post by:
Hi all,
I am seeking a module that will do the equivalent of linear regression in
3D to yield a best fit a plane through a set of points (X1, Y1, Z1), (X1,
Y1, Z1),... (Xn, Yn, Zn).
The...
|
by: Nod Lee |
last post by:
Hi all
Is there any tools/objects from Microsoft that I can use to perform linear
regression in webform and generate the results into a graph?
If not, is there any recommendations for 3rd...
|
by: abefroeman |
last post by:
I am trying to automate the regression function in the analysis tool pack. I tried to simply record myself doing a regression. When I run the macro, it cannot find the analysis tool pack. It says...
|
by: ntuyen01 |
last post by:
Hi All,
Does anyone has examples for Linear Regression formula using c#.
Or any good third party software create this.
Thanks in advance
Regards,
Ted
|
by: PlsHelp |
last post by:
Hi every1,this is my 1st time using this forum....pls can any1 tell me how to create a code in VB that can do LINEAR REGRESSION in excel.....i'm not sure how to xplain exactly what i need but...
|
by: drfish |
last post by:
Hi, I'm a complete novice when it comes to VB so need some help.
I would like a macro that performs linear regression for different cell ranges each time it is run, depending on the number of...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |