Extracting coefficients and their standard error for each unit in an lme model fit

后端 未结 2 1317
一向
一向 2020-12-16 23:58

How could I extract coefficients (b0 and b1) with their respectively standard errors for each experimental unit (plot )in a linear mixed model such as this one:

Bet

2条回答
  •  鱼传尺愫
    2020-12-17 00:27

    To get you partway there using nlme...

    You can pull the components of summary() using:

    summary(fitL1)$tTable[,1] #fixed-effect parameter estimates
    summary(fitL1)$tTable[,2] #fixed-effect parameter standard errors
    

    etc.

    You can further subset those by rows:

    summary(fitL1)$tTable[1,1] #the first fixed-effect parameter estimate
    summary(fitL1)$tTable[1,2] #the first fixed-effect parameter standard error
    

    to extract individual parameters or standard errors and combine them into a data frame using, for example:

    df<-data.frame(cbind(summary(fitL1)$tTable[1,1], summary(fitL1)$tTable[1,2]))
    names(df)<-c("Estimate","SE")
    df
    

    To adjust these parameters for each plot (the random effect, I presume), you can pull the random coefficients with:

    fitL1$coefficients$random
    

    and add them to the parameter estimates (B0 (intercept), B1, etc.). However, I am not sure how the standard errors should be adjusted for each plot.

提交回复
热议问题