我做PM10对心脑血管疾病门诊人数的影响,将PM10根据浓度大小分成四类,0-0.1为第一类,0.1-0.15为第二类,0.15=0.25第三类,大于0.25为第四类,我现在要求分别求出第一类,第二类,第三类,第四类分别对应得RR值,请问我如何实现呢
脚本如下
rm(dow)
rm(time)
rm(wind)
rm(press)
rm(vi)
rm(atemp)
rm(htemp)
rm(dtemp)
read.table("C:/Users/14916/Desktop/jieguo/XZshuju/XINZONGLF.txt",header=T,fill=T)->fitty
fix(fitty)
attach(fitty)
downum=factor(dow)
downum
library(mgcv)
fitty=gam(low~downum,family=poisson,na.action=na.omit)
summary(fitty)
AIC(fitty)
stat <-NULL
mod<-list()
for (i in 1:50){
mod [[i]]=fit=gam(low~downum+s(time,k=11,fx=T)+s(wind,k=3,fx=T)+s(press,k=3,fx=T)+s(dew,k=3,fx=T)+s(vi,k=11,fx=T)+s(htemp,k=i,fx=T),family=poisson,na.action=na.omit)
tt=AIC(mod[[i]])
stat<-append(stat,tt)
}
plot(x=(1:50),y=stat)
stat
summary(stat)
fitty=gam(low~downum+s(time,k=11,fx=T)+s(wind,k=3,fx=T)+s(press,k=3,fx=T)+s(dew,k=3,fx=T)+s(vi,k=11,fx=T)+s(atemp,k=7,fx=T)+PM10,family=poisson,na.action=na.omit)
summary(fitty)
AIC(fitty)