I am trying to plot a logistic regression in R. I currently have this code...
mylogit<- glm(Breeding.success ~ Dam.Age, family = binomial, data = captive)
summary(mylogit)
predicted.data<- as.data.frame(predict(mylogit, type="response", se=TRUE))
summary(predicted.data)
new.data <- cbind(captive, predicted.data)
graph <- ggplot(captive, aes(x=Dam.Age, y=Breeding.success)) +
geom_point()+
stat_smooth(method="glm", method.args = list(family="binomial"), se=FALSE) +
labs(x="Dam age", y="Breeding success")
I currently have a graph with a straight line, which I would like to be curved and smooth. Also I am struggling with plotting the confidence intervals. Any advice would be great, thanks.
I can give you the actual data used - http://datadryad.org/resource/doi:10.5061/dryad.58ff4.
I am reproducing some of the graphs as a part of a final year project. This code is for the breeding success plotted against the dam age.