[R-sig-ME] lme4 categorical outcome probability values at each time point
epalmery at cns.umass.edu
Fri Mar 25 10:46:47 CET 2016
Am new to the list, so defer by all means to more experienced opinions.
My suggestion would be to use the "lsmeans" package and the inverse logit
(to get back to the scale of probabilities from the hard-to-interpret
If you have time as a factor this will be no problem.
So before you run the model, specify
#then use lsmeans by R Lenth
# lsmeans(oranges.lm1, "day", at = list(price1 = 50, price2 = c(40,60), day
= c("2","3","4")) )
Newdf<- summary(lsmeans(workshop, ~Time*Condition))
#or if Time is numeric:
Newdf<- summary(lsmeans(workshop, ~Time*Condition, at=list(Time=c(1, 2, 3))
#if you need to graph standard errors, create a new column with raw std
#then transform the mean +/- SE
Newdf$selo<-Newdf$lsmeans - Newdf$SE
#now apply inverse logit
You should be able to plot the resulting variables using ggplot2 or your
package of choice.
You could also use inv.logit on the 95% confidence limits, though the error
bars tend to get pretty enormous with these reverse transformations and may
not seem to reflect any significant differences in your model.
Hope this helps!
On Fri, Mar 25, 2016 at 12:20 AM, Igor Yakovenko <iyakoven at ucalgary.ca>
> Hello Everyone,
> Does anyone know how to graph the results of a lme4 longitudinal multilevel
> model as a bar graph of Time (3 points) on x-axis with probability of
> getting the 1 value on the outcome after taking into account the predictors
> as the y-axis? Alternatively, if there is a way to derive the mean
> probability of the outcome being 1 (vs. 0) during an intervention at time
> 2 and 3 divided by Condition (two levels), I can graph those values
> separately. The model is based on data from a two-group RCT evaluating an
> intervention over 3 time points. Here is a sample model with a dichotomous
> outcome and fixed effects of time (continuous), condition (2 levels) and
> whether an additional workshop was completed (2 levels).
> workshop<-glmer(CurrentAsst~Time*Condition + Workshop_completion_reordered
> (1|id), data = vse, family = binomial, nAGQ = 25, control =
> glmerControl(optimizer = "bobyqa"))
> Thank you,
> Igor Yakovenko
> [[alternative HTML version deleted]]
> R-sig-mixed-models at r-project.org mailing list
Department of Biology
221 Morrill Science Center
611 North Pleasant St
Amherst MA 01003
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models