ord <- order(Start) start <- Start[ord] kyp <- Kyp[ord] agemod <- glm(kyp ~ poly(start,3), family=binomial) plot(start,fitted(startmod),type="l")