Matthew Ouellette
2012-Jul-20 15:56 UTC
[R] Extracting standard errors for adjusted fixed effect sizes in lmer
Dear R help list, I have done a lot of searching but have not been able to find an answer to my problem. I apologize in advance if this has been asked before. I am applying a mixed model to my data using lmer. I will use sample data to illustrate my question:>library(lme4) >library(arm) >data("HR", package = "SASmixed") > str(HR)'data.frame': 120 obs. of 5 variables: $ Patient: Factor w/ 24 levels "201","202","203",..: 1 1 1 1 1 2 2 2 2 2 ... $ Drug : Factor w/ 3 levels "a","b","p": 3 3 3 3 3 2 2 2 2 2 ... $ baseHR : num 92 92 92 92 92 54 54 54 54 54 ... $ HR : num 76 84 88 96 84 58 60 60 60 64 ... $ Time : num 0.0167 0.0833 0.25 0.5 1 ...> fm1 <- lmer(HR ~ baseHR + Time + Drug + (1 | Patient), HR)> fixef(fm1) ##Extract estimates of fixed effects(Intercept) baseHR Time Drugb Drugp 32.6037923 0.5881895 -7.0272873 4.6795262 -1.0027581> se.fixef(fm1) ##Extract standard error of estimates of fixed effects(Intercept) baseHR Time Drugb Drugp 9.9034008 0.1184529 1.4181457 3.5651679 3.5843026 ##Because the estimate of the fixed effects are displayed as differences from the intercept (I think?), I can back calculate the actual effect sizes easily enough. However, how would I do a similar calculation for the standard error for these effect sizes (since these error estimates are for the difference in means of effects) if my design isn't balanced (which confuses things tremendously when working with a data set as large as mine)? It may help to point out that I'm working with microarray data; applying the same model for each gene (hundreds of genes total) across multiple samples (hundreds of samples total), but as an R beginner I like to start with small data samples and work my way up. I appreciate the help, MO [[alternative HTML version deleted]]
Matthew Ouellette
2012-Jul-23 01:33 UTC
[R] Extracting standard errors for adjusted fixed effect sizes in lmer
Dear R help, Does no one have an idea of where I might find information that could help me with this problem? I apologize for re-posting - I have half a suspicion that my original message did not make it through. I hope you all had a good weekend and look forward to your reply, MO On Fri, Jul 20, 2012 at 11:56 AM, MO wrote:> Dear R help list, > > I have done a lot of searching but have not been able to find an answer to > my problem. I apologize in advance if this has been asked before. > > I am applying a mixed model to my data using lmer. I will use sample data > to illustrate my question: > > >library(lme4) > >library(arm) > >data("HR", package = "SASmixed") > > str(HR) > 'data.frame': 120 obs. of 5 variables: > $ Patient: Factor w/ 24 levels "201","202","203",..: 1 1 1 1 1 2 2 2 2 2 > ... > $ Drug : Factor w/ 3 levels "a","b","p": 3 3 3 3 3 2 2 2 2 2 ... > $ baseHR : num 92 92 92 92 92 54 54 54 54 54 ... > $ HR : num 76 84 88 96 84 58 60 60 60 64 ... > $ Time : num 0.0167 0.0833 0.25 0.5 1 ... > > > fm1 <- lmer(HR ~ baseHR + Time + Drug + (1 | Patient), HR) > > > fixef(fm1) ##Extract estimates of fixed effects > > (Intercept) baseHR Time Drugb Drugp > > 32.6037923 0.5881895 -7.0272873 4.6795262 -1.0027581 > > > se.fixef(fm1) ##Extract standard error of estimates of fixed effects > > (Intercept) baseHR Time Drugb Drugp > > 9.9034008 0.1184529 1.4181457 3.5651679 3.5843026 > > ##Because the estimate of the fixed effects are displayed as differences > from the intercept (I think?), I can back calculate the actual effect sizes > easily enough. However, how would I do a similar calculation for the > standard error for these effect sizes (since these error estimates are for > the difference in means of effects) if my design isn't balanced (which > confuses things tremendously when working with a data set as large as > mine)? It may help to point out that I'm working with microarray data; > applying the same model for each gene (hundreds of genes total) across > multiple samples (hundreds of samples total), but as an R beginner I like > to start with small data samples and work my way up. > > I appreciate the help, > > MO > >[[alternative HTML version deleted]]