On Feb 16, 2009, at 9:57 PM, Barker, Chris wrote:


Hi, I have a list of fit objects (fit objects from HMISC functions)

"Hmisc",  and they are actually probably from "Design" functions.



I create elements in the list in this way

lrm.sumtot <- lrm( ae7bepn ~ trarm  + sumtot  , data=sd.fix)

lrm.list[['lrm.sumtot']] <- lrm.sumtot

And I can run (anova(lrm.sumtot))

The following also gives the anova I'd expect
zz <- lrm.list[['lrm.sumtot']];anova(zz)


And similarly for the summary command

I would prefer not to create a second list with "anova" objects nor a
third list with "summary" objects.

Is there a way to use an sapply or lapply to  prepare anova or summary
for every element in my list of fit objects?

Note: these are are not nested models or even models built on the same data:


> mod.list.objs <- list(cph.A.S.H.T,cph.A.S.H.T.G,cph.A.S.H.T.G.S.D)
> mapply(anova, mod.list.objs)
[[1]]
                Wald Statistics          Response: srv900

Factor Chi-Square d.f. P Age 17522.30 2 <.0001 Nonlinear 2608.09 1 <.0001 Sex 39.90 1 <.0001 BL_HDL.A (Factor+Higher Order Factors) 2485.88 6 <.0001 All Interactions 77.97 4 <.0001 Nonlinear (Factor+Higher Order Factors) 59.72 3 <.0001 BL_CHOLEST.A (Factor+Higher Order Factors) 1170.03 6 <.0001 All Interactions 77.97 4 <.0001 Nonlinear (Factor+Higher Order Factors) 226.03 3 <.0001 BL_HDL.A * BL_CHOLEST.A (Factor+Higher Order Factors) 77.97 4 <.0001 Nonlinear 75.20 3 <.0001 Nonlinear Interaction : f(A,B) vs. AB 75.20 3 <.0001 f(A,B) vs. Af(B) + Bg(A) 59.16 1 <.0001 Nonlinear Interaction in BL_HDL.A vs. Af(B) 59.16 2 <.0001 Nonlinear Interaction in BL_CHOLEST.A vs. Bg(A) 68.80 2 <.0001 TOTAL NONLINEAR 2968.98 6 <.0001 TOTAL NONLINEAR + INTERACTION 3515.27 7 <.0001 TOTAL 23438.25 11 <.0001

[[2]]
                Wald Statistics          Response: srv900

Factor Chi-Square d.f. P Age 10025.10 2 <.0001 Nonlinear 105.89 1 <.0001 Sex 158.10 1 <.0001 BL_HDL.A (Factor+Higher Order Factors) 144.11 6 <.0001 All Interactions 32.53 4 <.0001 Nonlinear (Factor+Higher Order Factors) 91.43 3 <.0001 BL_CHOLEST.A (Factor+Higher Order Factors) 267.75 6 <.0001 All Interactions 32.53 4 <.0001 Nonlinear (Factor+Higher Order Factors) 243.49 3 <.0001 BL_GGT.A 395.13 1 <.0001 BL_HDL.A * BL_CHOLEST.A (Factor+Higher Order Factors) 32.53 4 <.0001 Nonlinear 15.82 3 0.0012 Nonlinear Interaction : f(A,B) vs. AB 15.82 3 0.0012 f(A,B) vs. Af(B) + Bg(A) 1.46 1 0.2271 Nonlinear Interaction in BL_HDL.A vs. Af(B) 11.91 2 0.0026 Nonlinear Interaction in BL_CHOLEST.A vs. Bg(A) 2.01 2 0.3658 TOTAL NONLINEAR 474.30 6 <.0001 TOTAL NONLINEAR + INTERACTION 475.48 7 <.0001 TOTAL 11723.84 12 <.0001

[[3]]
                Wald Statistics          Response: srv900

Factor Chi-Square d.f. P Age 9168.80 2 <.0001 Nonlinear 138.98 1 <.0001 Sex 48.89 1 <.0001 BL_HDL.A (Factor+Higher Order Factors) 85.17 6 <.0001 All Interactions 28.80 4 <.0001 Nonlinear (Factor+Higher Order Factors) 71.08 3 <.0001 BL_CHOLEST.A (Factor+Higher Order Factors) 301.41 6 <.0001 All Interactions 28.80 4 <.0001 Nonlinear (Factor+Higher Order Factors) 243.65 3 <.0001 BL_GGT.A 701.68 2 <.0001 Nonlinear 256.32 1 <.0001 BL_TRIGLYC.A 0.33 1 0.5647 BP.B 1.27 1 0.2596 BP.A 546.29 1 <.0001 BL_HDL.A * BL_CHOLEST.A (Factor+Higher Order Factors) 28.80 4 <.0001 Nonlinear 11.82 3 0.0080 Nonlinear Interaction : f(A,B) vs. AB 11.82 3 0.0080 f(A,B) vs. Af(B) + Bg(A) 5.61 1 0.0178 Nonlinear Interaction in BL_HDL.A vs. Af(B) 10.35 2 0.0057 Nonlinear Interaction in BL_CHOLEST.A vs. Bg(A) 5.65 2 0.0594 TOTAL NONLINEAR 677.48 7 <.0001 TOTAL NONLINEAR + INTERACTION 679.59 8 <.0001 TOTAL 11874.22 16 <.0001

mapply(summary, ...) also works
--
David Winsemius



Thank you in advance

   Chris Barker, Ph.D.
 Statistical Consultant
  650 384 8617


        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to