# Flexible regression - lecture 1 library(sm) sm.options(describe = FALSE) sm.options(show.script = FALSE) #----------------------------------------------------- # The aircraft data #----------------------------------------------------- provide.data(aircraft) pairs(aircraft) pairs(log(aircraft[ , 3:8])) hist(Span) y <- log(Span)[Period == 3] hist(y) sm.density(y) sm.density(y, panel = TRUE) library(sm) provide.data(aircraft) sm.script(air_scat) sm.density(pc3, panel = TRUE) temp <- sm.density(pc3, display = "image") #----------------------------------------------------- # The Old Faithful geyser data #----------------------------------------------------- provide.data(geys3d) rp.plot3d(Waiting, Next.waiting, Duration) sm.density(geys3d, panel = TRUE) #----------------------------------------------------- # The Tephra data #----------------------------------------------------- provide.data(tephra) logit <- log(Al2O3/(100-Al2O3)) sm.density(logit, panel = TRUE) #----------------------------------------------------- # The radiocarbon data #----------------------------------------------------- provide.data(radioc) cal.age <- Cal.age[Cal.age>2000 & Cal.age<3000] rc.age <- Rc.age[Cal.age>2000 & Cal.age<3000] plot(cal.age, rc.age) model <- lm(rc.age ~ poly(cal.age, 2)) lines(cal.age, fitted(model)) sm.regression(cal.age, rc.age, panel = TRUE) #----------------------------------------------------- # The Great Barrier Reef data #----------------------------------------------------- sm.script(trwlband) sm.script(trwlplot) Zone93 <- (Year == 1 & Zone == 1) Position <- cbind(Longitude, Latitude) sm.regression(Position[Zone93, ], Score1[Zone93], panel = TRUE)