[R-sig-ME] Can we do b-spline within lmer function?

vito muggeo vmuggeo at dssm.unipa.it
Tue Jan 15 09:57:28 CET 2008


Dear Zhong,
Two (probably) minor comments:
(i) As stated in ?bs, "bs(x)" defaults to a simple third degree 
polynomial, therefore if you wants real splines you have to play with 
the argument df and/or knots.

(ii) In theory you can move to penalized B-splines (i.e., P-splines 
which appear to be preferable to simple b-splines) in a mixed model 
framework. However lmer and friends may not be used because it does not 
appear possible to specify the proper covariance matrix for the random 
effects (you should use a multiple of identity matrix as pdDiag in 
nlme::lme())

all the best,
vito



Zhong, Xiao ha scritto:
> Thanks, Ken.
> 
> I tried your advice on my model:
> 
> model2.growth.mcas5 <- lmer(response ~ bs(monthElapsed) + skills + (1|studentID), data= mcas5, family=binomial(link="logit"), control =
> list(msVerbose = 1, usePQL = FALSE))
> 
> It worked! What it gave me is:
> 
>                       (Intercept)                  bs(monthElapsed)1                  bs(monthElapsed)2                  bs(monthElapsed)3
>                         -0.1509712                          0.7019262                         -0.1934738                          0.6257330
>                   skillsG-Geometry                skillsM-Measurement    skillsN-Number-Sense-Operations skillsP-Patterns-Relations-Algebra
>                         -0.4333880                         -0.9468761                          0.5263370                          0.1897903
> 
> Since I am trying to use design matrix to predict after that glmm fitting, could you tell me if there is some function/command that I can use to find what the three "bs" did to my "monthElapsed" variable?
> 
> Thanks!
> 
> Xiao
> 
> 
> ________________________________________
> From: Ken Beath [kjbeath at kagi.com]
> Sent: Monday, January 14, 2008 3:29 PM
> To: Zhong, Xiao
> Cc: r-sig-mixed-models at r-project.org
> Subject: Re: [R-sig-ME] Can we do b-spline within lmer function?
> 
> On 15/01/2008, at 2:59 AM, Zhong, Xiao wrote:
> 
>> Hello,
>>
>> I am working on a project that uses glmm. I would like to consider b-
>> spline in the original glmm but I couldn't find how to add b-spline
>> terms to the normal lmer function. Is there anybody who could help
>> me with that?
>>
> 
> library(splines)
> fm2 <- lmer(Reaction ~ bs(Days) + (1|Subject), sleepstudy)
> 
> Ken
> 
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> 
> 

-- 
====================================
Vito M.R. Muggeo
Dip.to Sc Statist e Matem `Vianelli'
Università di Palermo
viale delle Scienze, edificio 13
90128 Palermo - ITALY
tel: 091 6626240
fax: 091 485726/485612




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