daytime <- (1:365)-0.5
daybasis <- create.fourier.basis(c(0,365), 365)
harmLcoef <- c(0,(2*pi/365)^2,0)
harmLfd <- vec2Lfd(harmLcoef, c(0,365))
templambda <- 0.01
dayfd <- fda::fd(matrix(0, daybasis$nbasis, 1), daybasis)
tempfdPar <- fda::fdPar(dayfd, harmLfd, templambda)
# do not run on CRAN because it takes too long.
tempfd <- smooth.basis(daytime,
CanadianWeather$dailyAv[,,"Temperature.C"], tempfdPar)$fd
tempctrfd <- center.fd(tempfd)
oldpar <- par(no.readonly= TRUE)
plot(tempctrfd, xlab="Day", ylab="deg. C",
main = "Centered temperature curves")
par(oldpar)
Run the code above in your browser using DataLab