glmer with qplot

78 views
Skip to first unread message

zozi9126

unread,
Jan 22, 2016, 9:19:10 AM1/22/16
to ggplot2
Dear ggplot2 mailing list members!

I'm Zoltan Radai (PhD student at the University of Debrecen, Hungary), I hope You don't find my question trivial, but - though I've checked a fair share of the tutorials, descriptions and mailing / forum threads - I did not find answer to my question elsewhere. Namely, I'd like to use qplot for plotting predictions of a glmer model in the following way:

qplot(x, predict(model1, type="response"), data=data, geom=c("point","smooth"), method="glmer", family="poisson", formula=y~x)

An error message warns that - quite obviously - I did not specified random effects. My question is pretty simple: how can I specify random terms in qplot?

Thanks in advance!
ZR


-- 
Behavioural Ecology Research Group 
Dept. of Evolutionary Zoology and Human Biology, lab. 1.046
University of Debrecen, 4032 Debrecen,
Hungary, Egyetem tér 1.

Ben Bolker

unread,
Jan 22, 2016, 9:28:14 AM1/22/16
to zozi9126, ggplot2


On 16-01-22 07:18 AM, zozi9126 wrote:
> Dear ggplot2 mailing list members!
>
> I'm Zoltan Radai (PhD student at the University of Debrecen, Hungary), I
> hope You don't find my question trivial, but - though I've checked a
> fair share of the tutorials, descriptions and mailing / forum threads -
> I did not find answer to my question elsewhere. Namely, I'd like to use
> qplot for plotting predictions of a glmer model in the following way:
>
> qplot(x, predict(model1, type="response"), data=data,
> geom=c("point","smooth"), method="glmer", family="poisson", formula=y~x)
>
> An error message warns that - quite obviously - I did not specified
> random effects. My question is pretty simple: how can I specify random
> terms in qplot?
>
> Thanks in advance!
> ZR

I think you're pushing the limits of what geom_smooth()
can do internally, and that you'll be better off doing the glmer
fit externally, making a prediction data frame, and then adding it
to the plot: e.g. check out


https://rawgit.com/bbolker/mixedmodels-misc/master/ecostats_chap.html#prediction-1

> --
> Behavioural Ecology Research Group
> Dept. of Evolutionary Zoology and Human Biology, lab. 1.046
> University of Debrecen, 4032 Debrecen,
> Hungary, Egyetem tér 1.
>
> http://zoology.unideb.hu/?m=Zolt%C3%A1n_R%C3%A1dai
>
> --
> --
> You received this message because you are subscribed to the ggplot2
> mailing list.
> Please provide a reproducible example:
> https://github.com/hadley/devtools/wiki/Reproducibility
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
> ---
> You received this message because you are subscribed to the Google
> Groups "ggplot2" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ggplot2+u...@googlegroups.com
> <mailto:ggplot2+u...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages