[R-sig-ME] Plotting best fit lines binomial GLMM

M West m.westinbrook at gmail.com
Mon Feb 1 01:35:30 CET 2016


aha, you are right - sorry, I received a weird error message earlier saying
it wasn't available for glmer....that doesn't appear now. thanks.

On Sun, Jan 31, 2016 at 5:59 PM, Fox, John <jfox at mcmaster.ca> wrote:

> Dear M.,
>
> The effects package does work with GLMMs fit with glmer() in the lme4
> package. See ?Effect. Here's an example adapted from ?glmer:
>
>         library(effects)
>         library(lme4)
>         library("HSAUR2")
>         gm2 <- glmer(outcome~treatment*visit+(1|patientID),
>                  data=toenail, family=binomial, nAGQ=20)
>         Effect(c("treatment", "visit"), gm2)
>
> producing
>
> treatment*visit effect
>               visit
> treatment              1         2          3          4           5
>      6            7
>   itraconazole 0.2236820 0.1155113 0.05588527 0.02612852 0.012014461
> 0.005481597 0.0024920184
>   terbinafine  0.2104865 0.0871212 0.03303451 0.01208159 0.004358651
> 0.001564643 0.0005606578
>
> I hope this helps,
>  John
>
> -----------------------------
> John Fox, Professor
> McMaster University
> Hamilton, Ontario
> Canada L8S 4M4
> Web: socserv.mcmaster.ca/jfox
>
>
>
>
> > -----Original Message-----
> > From: R-sig-mixed-models [mailto:r-sig-mixed-models-bounces at r-
> > project.org] On Behalf Of M West
> > Sent: January 31, 2016 11:29 PM
> > To: Phillip Alday <Phillip.Alday at unisa.edu.au>
> > Cc: r-sig-mixed-models at r-project.org
> > Subject: Re: [R-sig-ME] Plotting best fit lines binomial GLMM
> >
> > Thanks for this suggestions Philip  - it looks like the effects package
> doesn't
> > work for GLMMs - it works with glms.....
> >
> > On Sun, Jan 31, 2016 at 1:05 AM, Phillip Alday <
> Phillip.Alday at unisa.edu.au>
> > wrote:
> >
> > > Addressing the plotting issue: look at the effects package. You can
> > > directly plot effects objects (which will yield lattice plots) or you
> > > can convert them to data frames and plot by hand (e.g. if you want
> > > more control and/or ggplot).
> > >
> > > Best,
> > > Phillip
> > >
> > > On 30/01/16 08:18, M West wrote:
> > > > Main questions:
> > > > (1) How to extract coefficients from GLMM to plot best fit lines to
> data?
> > > > (2) Are there other options for dealing with these sorts of data
> > > > besides mixed effects models (or RM ANOVA)?
> > > >
> > > >
> > > > Specifics: I have a short time series data across 12 sites over 8
> years.
> > > > I'd like an omnibus plot that summarizes the main pattern interest
> > > > in
> > > these
> > > > data.
> > > >
> > > > The dependent variable is frequency females (data are # smokers out
> > > > of
> > > the
> > > > total population). The independent variable is also a frequency (#
> > > infected
> > > > out of the total population).
> > > >
> > > > Plotting each year separately it's easy to see the positive
> > > > correlation between smokers and infection. However, given the
> > > > variation among years, plotting all the data on a single plot
> > > > obscures the overall pattern....I need to fit regression lines to
> > > > each year.
> > > >
> > > > I know how to do this with lme....but I can't quite find how to do
> > > > this with GLMM and I've analyzed the data with a GLMM with a
> > > > binomial distribution (following Crawley) [While the data are
> > > > binomial, they are not binary (i.e., not 0 and 1)so a logistic curve
> > > > doesn't work].
> > > >
> > > >
> > > > I found this thread on inspecting the residuals but I haven't been
> > > > able
> > > to
> > > > find anything on plotting a best fit line for these type of data.
> > > >
> > > >
> > > http://stats.stackexchange.com/questions/70783/how-to-assess-the-fit-o
> > > f-a-binomial-glmm-fitted-with-lme4-1-0
> > > >
> > > >
> > > > I would *much prefer* to use something other than mixed effects
> > > > models (I think the results are not straightforward to interpret and
> > > > every book or blog recommends a different approach) for this
> > > > analysis so if there are other suggestions they are also welcome!
> > > >
> > > > Thanks,
> > > > M.
> > > >
> > > >       [[alternative HTML version deleted]]
> > > >
> > > > _______________________________________________
> > > > R-sig-mixed-models at r-project.org mailing list
> > > > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> > > >
> > >
> >
> >       [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-mixed-models at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list