Displaying 1 result from an estimated 1 matches for "logchl".
2012 Oct 26
0
Seasonal smoothing of data with large gaps (mgcv)
...available
all year around at some sites - in some cases only in summer for example.
The code below (hopefully) should give you an indication of the problem.
#Setup
set.seed(42)
n <- 500
#Generate some randomly distributed observations during (southern) summer
t <- rnorm(n,mean=0,sd=25)%%365
logchl <- cos(t/365*2*pi)^2 +rnorm(n,sd=0.025)
#Now add a seasonal GAM
library(mgcv)
mdl <- gam(logchl ~ s(t,bs="cc"),knots=list(t=c(0,365)))
#Plot
plot(t,logchl,xlab="Day of year",ylab="Log Chl",xlim=c(0,365),xaxs="i")
t.grid <- data.frame(t=seq(0,365,len=...