I interact with nlme and lme4 R functions through RPy and I would like to access the summary of output from my python console.
I run the following code:
test1=nlme.lme(r.formula('Pupil~CoI*Time'), random=r.formula('~1|ID'),data=dfr)
test2=nlme.lme(r.formula('Pupil~CoI*measurement'),random=r.formula('~1|ID'),data=dfr)
test1_sum= r.summary(test1)
test2_sum= r.summary(test2)
print test1_sum
print test2_sum
for nlme, and this is for lme4:
test1=lme4.lmer(r.formula('Pupil~CoI*Time+(1|ID)'),data=dfr)
test2=lme4.lmer(r.formula('Pupil~CoI*measurement+(1|ID)'),data=dfr)
test1_sum= r.summary(test1)
test2_sum= r.summary(test2)
print test1_sum
print test2_sum
To get a code snippet with data and explicit import, refer to this IPython notebook .
In all cases, I get a huge amount of print output, which includes a terribly long section, similar to:
Data: structure(list(CoI = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L ......
I would like to get a more detailed description as:
Random effects:
Formula: ~1 | ID
(Intercept) Residual
StdDev: 0.2201214 0.1199874
Fixed effects: Pupil ~ CoI * measurement
Value Std.Error DF t-value p-value
(Intercept) 1.2068660 0.06369911 5769 18.946357 0
CoIhard -0.0394413 0.00629117 5769 -6.269306 0
measurement -0.0002743 0.00003207 5769 -8.554287 0
CoIhard:measurement 0.0005227 0.00004536 5769 11.524511 0
Correlation:
(Intr) CoIhrd msrmnt
CoIhard -0.049
measurement -0.060 0.612
CoIhard:measurement 0.043 -0.865 -0.707
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-9.86773055 -0.37638950 0.02085029 0.43203795 4.97364143
Number of Observations: 5784
Number of Groups: 12
(which is included in what I get, but only thousands of records after the above) How do I achieve this?