Can one extract model fit parameters after a ggplot stat_smooth call?
Posted
by Alex Holcombe
on Stack Overflow
See other posts from Stack Overflow
or by Alex Holcombe
Published on 2010-04-19T11:02:52Z
Indexed on
2010/04/19
12:33 UTC
Read the original article
Hit count: 168
Using stat_smooth, I can fit models to data. E.g.
g=ggplot(tips,aes(x=tip,y=as.numeric(unclass(factor(tips$sex))-1))) +facet_grid(time~.)
g=g+ stat_summary(fun.y=mean,geom="point")
g=g+ stat_smooth(method="glm", family="binomial")
I would like to know the coefficients of the glm binomial fits. I could re-do the fit with dlply and get the coefficients with ldply, but I'd like to avoid such duplication.
Calling str(g) reveals the hierarchy of objects that ggplot creates, perhaps there's some way to get to the coefficients through that?
© Stack Overflow or respective owner