system.time({
for(i in seq(data)){
sub<-data[[i]]
suppressWarnings({
cb<-crossbasis(sub$atemp,lag=lag,argvar = argvar,arglag = arglag)
})
mfirst<-glm(bron~cb+ns(time,7*14)+dow + season + ns(arh,3),family = quasipoisson(),sub)
suppressWarnings({
crall<-crossreduce(cb,mfirst)
})
suppressWarnings({
crhot<-crossreduce(cb,mfirst,type="var",value = 30.88)
})
suppressWarnings({
crcold<-crossreduce(cb,mfirst,type = "var",value = -1)
})
yall[i,]<-coef(crall)
Sall[[i]]<-vcov(crall)
yhot[i,]<-coef(crhot)
Shot[[i]]<-vcov(crhot)
ycold[i,]<-coef(crcold)
Scold[[i]]<-vcov(crcold)
qaic[i]<-fqaic(mfirst)
}
})
When I run this set of R , I get a “length of 'derivs' is larger than length of 'x'” error, and I have never understood what went wrong. thanks