Home > Software design >  linear mixed model with log-transformation in R: Compute standard deviation or 95%CI for specific es
linear mixed model with log-transformation in R: Compute standard deviation or 95%CI for specific es

Time:07-08

I use a mixed model to compute velocity estimates for specific locations (4 categories) at a chosen frequency (continuous) in R.

This is what I have so far:

lmer.df = lmer(log(velocity) ~ location   frequency   (1 | heart), data = df)

emm = emmeans(lmer.df, specs = ~ location, type = "response")

summary(emm, infer = TRUE)  #back-transformed estimated marginal means (for mean frequency)
summary(contrast(emm, method = "revpairwise", infer = TRUE)) #back-transformed pairwise comparisons with SE and 95%CI

How can I compute the standard deviation (or confidence intervals) for estimated values at specific frequencies? Using emmeans(), I get the SE and 95%CI for the estimated velocities at mean frequency. I would need a similar table for, i.e., frequency = 90.

CodePudding user response:

How can I compute the standard deviation (or confidence intervals) for estimated values at specific frequencies? Using emmeans() I get the SE and 95%CI for the estimated velocities at mean frequency. I would need a similar table for i.e. frequency = 90.

You can control the reference grid for frequency:

emmGridObj <- ref_grid(lmer.df, at = list(frequency = 90))
emm <- emmeans(emmGridObj, specs = ~ location, type = "response")
``
  • Related