[R] ggplot2 stat_smooth

Nathan Pace n.l.pace at utah.edu
Wed Jun 29 23:17:59 CEST 2016


I want to add a logistic plot to data.

My call to ggplot is:


ggplot(data = SSI.dt, aes(x = elapsed, y = 1 - control)) + geom_point() +
stat_smooth(method = 'glm', family = binomial) +
xlab('Surgery Duration (min)') + ylab('Probability SSI') +
labs(title = 'THA Surgical Site Infections')
ggsave(filename = 'Plots/SSI.Duration.pdf’)

An error message is returned: Unknown parameters: family

Removing “family = binomial” returns a straight line with points appropriately placed on y = 0 and y = 1.

I found some previous messages on markmail that listed my call as the correct syntax structure.

I’d appreciate thoughts/pointers.


Nathan

-- 
Nathan Pace, MD, MStat
Department of Anesthesiology
University of Utah
801.581.6393
n.l.pace at utah.edu









More information about the R-help mailing list