Re: [Rpy] Accessing lm() elements

2008-12-13 Thread Laurent Gautier
Gary Strangman wrote: > >>> (Intercept) 10.9205792 2.9934159 3.6481997 0.001341692 >>> prerbmt 0.4226101 0.1729016 2.4442236 0.022599474 >>> mri -0.3495370 0.7497424 -0.4662095 0.645450898 >>> >>> ... and if I want the estimate for the 2nd coefficient ... >>> >> print summary

Re: [Rpy] Accessing lm() elements

2008-12-13 Thread Gary Strangman
>> (Intercept) 10.9205792 2.9934159 3.6481997 0.001341692 >> prerbmt 0.4226101 0.1729016 2.4442236 0.022599474 >> mri -0.3495370 0.7497424 -0.4662095 0.645450898 >> >> ... and if I want the estimate for the 2nd coefficient ... >> > print summary[3][1] >> 0.4226101 > > You c

Re: [Rpy] Accessing lm() elements

2008-12-12 Thread Laurent Gautier
Gary Strangman wrote: > Hi again, > > Forgive me if this is a completely silly question for rpy2. I'm trying to > wean myself from rpy, but am confused by the new approach to conversion. > If I fit a model and collect summary info as follows ... > > fit = robjects.r.lm(fmla,data) > summary = ro

Re: [Rpy] Accessing lm() elements

2008-12-12 Thread Laurent Gautier
laurent oget wrote: > I do std-error=r['$'](summary,'sigma') Smart use of "$". Other possible way: summary.r["sigma"][0][0] > I think r.names(summary) will give you the components. It gives the names of the components. Consider the following example: import rpy2.robjects as ro fit = ro.

Re: [Rpy] Accessing lm() elements

2008-12-12 Thread Gary Strangman
Thanks! (I probably never would have come up with those.) FWIW, I also just stumbled across the option of doing numpy.array(summary[3]) which gives me a 3x4 array that I can index normally. So, I appear to be fully up-and-running now. Thanks! Gary P.S. The impetus for the switch was a kind of

Re: [Rpy] Accessing lm() elements

2008-12-12 Thread laurent oget
I do std-error=r['$'](summary,'sigma') I think r.names(summary) will give you the components. Laurent 2008/12/12 Gary Strangman : > > Hi again, > > Forgive me if this is a completely silly question for rpy2. I'm trying to > wean myself from rpy, but am confused by the new approach to conversion.

[Rpy] Accessing lm() elements

2008-12-12 Thread Gary Strangman
Hi again, Forgive me if this is a completely silly question for rpy2. I'm trying to wean myself from rpy, but am confused by the new approach to conversion. If I fit a model and collect summary info as follows ... fit = robjects.r.lm(fmla,data) summary = robjects.r.summary(fit) ... the summar