# mixed model spline terms at multiple levels of grouping
Spruce$Zday <- smspline(~ days, data=Spruce)
Spruce$all <- rep(1,nrow(Spruce))
# overall spline term, random plot and Tree effects
spruce.fit1 <- lme(logSize ~ days, data=Spruce,
                   random=list(all= pdIdent(~Zday -1),
                     plot=~1, Tree=~1))
# try overall spline term plus plot level linear + spline term
spruce.fit2 <- lme(logSize ~ days, data=Spruce,
                   random=list(all= pdIdent(~Zday - 1),
                     plot= pdBlocked(list(~ days,pdIdent(~Zday - 1))),
                     Tree = ~1))

This is the sample code from the help(smspline) documentation. I am have some trouble understanding the statistical model behind this example. What exactly is Spruce$Zday <- smspline(~ days, data=Spruce) accomplishing? Is it creating a set of random effects for the days variable?

Can the model fit by spruce.fit1 be written out as:

$Y_{ij} = \beta_1 + \beta_2 t_{ij} + \sum_{m=1}^{11} a_m(t_{ij} - \kappa_m)_+ + b_{1i}+b_{2i}t_{ij} + b_{3i}plot + b_{4i}tree + \epsilon_{ij}$? because there is a random effect for plot and a random effect for tree. And how is this different from the formulation of spruce.fit2?

What does the below output from summary(spruce.fit1) mean?

 Formula: ~1 | plot %in% all
StdDev:   0.0890616

 Formula: ~1 | Tree %in% plot %in% all
        (Intercept) Residual
StdDev:    0.621729 0.176505

Is this referring to the variance-covariance matrix of the plot and tree random effects? I am have a difficult time relating the code/output to the actual statistical concepts.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.