Displaying 2 results from an estimated 2 matches for "pm10median".
2011 Jun 21
5
please help for mgcv package
i read a book from WOOD, there's an example which is talking about the
pollutant.
library(gamair)
library(mgcv)
y<-gam(death~s(time,bs="cr",k=200)+s(pm10median,bs="cr")+s(so2median,bs="cr")+s(o3median,bs="cr")+s(tmpd,bs="cr"),data=chicago,family=Possion)
lag.sum<-function(a,10,11)
{n<-length(a)
b<-rep(0,n-11)
for(i in 0:(11-10))
b<-b+a[(i+1):(n-11+i)]
b}
death<-chicago$death[4:5114]
time<-chicag...
2012 Nov 13
0
GAM model to reduce PACF of a model
...de in the mgcv package to study associations of
environmental pollutants and mortality. The aim is to choose a model with
lowest mgcv and also to reduce the PACF to less than < |0.1|.
library(gamair)
library(mgcv)
data(chicago)
y<-matrix(0,12,5)
for (i in 1:12) {
testdf<-gam(death ~ pm10median + o3median + s(time,k=i*14,fx=T) +
s(tmpd,bs="cr"), data=chicago,family=poisson)
y[i,1]<-i
y[i,2]<-summary(testdf)$p.coeff[2]
ll<-summary(testdf)$p.coeff[2]-1.96*summary(testdf)$se[2]
ul<-summary(testdf)$p.coeff[2]+1.96*summary(testdf)$se[2]
y[i,3]<...