Thanks in advance:
I am trying to get the condition index of multiple linear models to test
collinearity using the perturb library. Using some simple data as a test,
this is done in R if the perturb library is downloaded:
x = c(5.05, 6.75, 3.21, 2.66)
y = c(1.65, 26.5, -5.93, 7.96)
model = lm(y~x)
library(perturb)
colldiag(model)[1]
In Python using Rpy i tried this:
import rpy
x = [5.05, 6.75, 3.21, 2.66]
y = [1.65, 26.5, -5.93, 7.96]
rpy.set_default_mode(rpy.NO_CONVERSION)
model = rpy.r.lm(rpy.r("y ~ x"), data = rpy.r.data_frame(x=x, y=y))
rpy.r.library ("perturb")
rpy.r.colldiag(model)
however i get this error:
Traceback (most recent call last):
File
"C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
File "X:\Dillon\Dillon BAR\Thesis\Python_code\test.py", line 19, in ?
rpy.r.colldiag(model)
RException: Error in get(x, envir, mode, inherits) : variable "x" of mode
"numeric" was not found
Anyone know why R returns an error in the get() function? I have been able
to call other functions on the Robject "model" such as AIC and summary
without an error. Just for refference, I am running python 2.4 with R
2.4.1in PythonWin.
cheers,
Dillon
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list