source("http://192.38.117.59/~linearpredictors/datafiles/readFever.R") # We need the factorlevels as numeric values, # in order to calculate the smooth: fever$deathValues <- as.numeric(fever$death)-1 formula <- fever$deathValues ~ fever$alco smoothed <- loess(formula, degree=1, span = 0.75) plot(smoothed$x,smoothed$fitted, pch=20, xlab="Drinks per week", ylab="Fetal death", ylim=c(0,0.04), yaxp=c(0,0.04,4)) points(smoothed)