Skip to content

Instantly share code, notes, and snippets.

View eric-pedersen's full-sized avatar

Eric Pedersen eric-pedersen

View GitHub Profile
@eric-pedersen
eric-pedersen / extr2.R
Last active May 29, 2020 18:51 — forked from dill/extr.R
Forecasting with B-splines
# extrapolating into the future with B-splines
# based on code in ?smooth.construct.bs.smooth.spec
library(mgcv)
# annual diameter of women’s skirts at the hem 1866 to 1911
# Hipel and McLeod, 1994
skirts <- scan("http://robjhyndman.com/tsdldata/roberts/skirts.dat",skip=5)
skirtseries <- data.frame(year=1866:1911, diam=skirts)
@eric-pedersen
eric-pedersen / extr-varying-starts.R
Last active May 30, 2020 17:38 — forked from dill/extr.R
Forecasting with B-splines
library(mgcv)
# annual diameter of women’s skirts at the hem 1866 to 1911
# Hipel and McLeod, 1994
skirts <- scan("http://robjhyndman.com/tsdldata/roberts/skirts.dat",skip=5)
skirtseries <- data.frame(year=1866:1911, diam=skirts)
# prediction grid
pd <- data.frame(year=seq(1864, 1960, by=1))