[R-sig-ME] Saving object into a Matrix/List

OLANO NO Nicolas (Exterieur.DCL) nicolas.no.olano at dexia.com
Tue Mar 1 11:10:35 CET 2016


Thank you very much Marko! I'll try this tomorrow.

Regards,

Nicolas Olano
Risk Quantification & Pricing
Dexia Group
(+32) (0)2 213 5873

-----Original Message-----
From: marko.bachl at gmail.com [mailto:marko.bachl at gmail.com] On Behalf Of Marko Bachl
Sent: lundi 29 février 2016 19:53
To: OLANO NO Nicolas (Exterieur.DCL)
Cc: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] Saving object into a Matrix/List

Hi Nicolas,
I guess drop1(fitted_model, test = "Chisq") will give you the desired result for omitting each term:

library(lme4)
fm <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy) drop1(fm, test = "Chisq")

If you want to make more adjustments, you could save the fitted models to a list and then use do.call():
fm_list = list()
fm_list[1] <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy) fm_list[2] <- lmer(Reaction ~ Days + (1 | Subject), sleepstudy) do.call("anova", fm_list)

Best regards
Marko




2016-02-29 15:49 GMT+01:00 OLANO NO Nicolas (Exterieur.DCL)
<nicolas.no.olano at dexia.com>:
>
> Hello,
>
> First of all, thank you very much for the package!
>
> I'm using the new version of lme4 and the function glmer and I would like to know if you could help me with one doubt.
>
> I want to compute the likelihood ratio test p value for each variable  (normally two or three variables) so run gm_original <- glmer (...~ X1 +  X2...), then gm_minus_X1 <- glmer (...~ X1...), finally anova(gm_original, gm_minus_X1).
>
> As I have to compute it in a for loop with a lot of combinations of  variables, I would like to know if there is any way to save the  results (gm_original) into a matrix or list to then use them to calculate the  p values (when I add the objet to a list, and then I to run an anova,  I receive the error that it cannot be computed from a list objet).
>
> Furthermore, is there any more efficient way to compute the likelihood  ratio test p value ?
>
> Thank you very much,
>
> Regards,
>
> Nicolas Olano
> Risk Quantification & Pricing
> Dexia Group
> (+32) (0)2 213 5873
>
> ----------------------------------------------------------------------
> ---
> Dexia disclaimer:
>
> http://www.dexia.com/maildisclaimer.htm 
> <http://www.dexia.com/maildisclaimer.htm>
> ----------------------------------------------------------------------
> ---
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list 
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models




--
Dr. Marko Bachl
Universität Hohenheim
Institut für Kommunikationswissenschaft (540C) T 0711 459 228 66 M marko.bachl at uni-hohenheim.de W www.komm.uni-hohenheim.de/bachl
-------------------------------------------------------------------------
Dexia disclaimer:

http://www.dexia.com/maildisclaimer.htm <http://www.dexia.com/maildisclaimer.htm>
-------------------------------------------------------------------------


More information about the R-sig-mixed-models mailing list