# # Written by: # -- # John L. Weatherwax 2009-04-21 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # #----- library(ElemStatLearn) # loads the data frame SAheart library(splines) # Computes the logistic regression model using natural splines (note famhist is included as a factor): form = "chd ~ ns(sbp,df=4) + ns(tobacco,df=4) + ns(ldl,df=4) + famhist + ns(obesity,df=4) + ns(alcohol,df=4) + ns(age,df=4)" form = formula(form) m = glm( form, data=SAheart, family=binomial ) print( summary(m), digits=3 ) # Duplicates the numbers from Table 5.1: # drop1( m, scope=form, test="Chisq" )