Hello,
I need some help. I'm fitting some data to a general linear model and
everything works find in R, but when I try to write a Python script and use
RPy to interface with R, it doesn't work.
Here is my command lines in R;
> library(foreign)
> library(stats)
> dat <- read.dbf("D:/rTesting/myDataFile.dbf", as.is=FALSE)
> glm.test2 <- glm(CIAR ~ ROADDIST + TRAILDIST + ELEV + COSASP + SINASP +
SOLRAD + BURN + TREE + BAND3 + BAND5 + BAND7,
family=binomial(link="logit"), data = dat, na.action=na.exclude,
control=glm.control(maxit=50))
> step2 <-step(glm.test2, steps=500)
Here's what I'm doing in my Python Script;
import rpy
from rpy import r
r.library("foreign")
r.library("stats")
dat = r.read_dbf("D:/rTesting/myDataFile.dbf") #FIXME: can't get
as_is =" FALSE" to work
r.attach(dat)
fam = r.binomial(link='logit')
#print fam
#cntrl = r.glm_control(maxit=50) #FIXME: Can't get this to work -
separately like this or directly in the cmd below
#print cntrl
glm_eqn = r.glm(r("CIAR ~ ROADDIST + TRAILDIST + ELEV + COSASP + SINASP +
SOLRAD + BURN + TREE + BAND1 + BAND3 + BAND5 + BAND7"), data=dat,
family=fam, na_action="na.exclude")
part2 = r.step(glm_eqn, steps=500)
The r.glm works fine, but I get an error with r.step. Here's the error
message;
Traceback (most recent call last):
File "D:\pythonScripts\testScript4rpy.py", line 81, in <module>
part2 = r.step(glm_eqn, steps=500)
RPy_RException: Error in UseMethod("extractAIC") : no applicable method for
"extractAIC"
I've tried defining an extractAIC object, but that doesn't seem to work
either.
I would be most appreciative of any suggestions. Notice also my 'FIXME'
comments, also. These omissions don't seem to effect anything, but I don't
understand why they won't work in my Python script, when the work in R.
Thank you in advance - Vickie
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list