#构建了dlnm模型,但是结果很奇怪,是我的模型没有统计学意义?还是有问题呢?
#代码如下:
temp1 <- data2[,c(33:397)]
colnames(temp1) <- paste("lag", 0:364, sep= "")
arglag <-equalknots(c( 0, 364), fun= "ns", df= 3, intercept= FALSE) ####
##非线性
cbTM1 <- crossbasis(temp1,lag=c( 0,364),argvar=list(fun= "ns",df= 3),arglag=list(knots=arglag))
summary(cbTM1)
model<-glm(XX ~ cbTM1+bmi+age,family = binomial(link = "logit"),data=data2)
summary(model)
AIC(model)
BIC(model)
##预测模型
pred.temp <- crosspred(cbTM1,model,by= 0.2,cumul = TRUE)
##最低点参考值
cen<-pred.temp$predvar[which.min(pred.temp$allfit)];cen
##重新预测模型
pred.temp <- crosspred(cbTM1,model,by= 0.2,cumul = TRUE,cen =cen)
par(mfrow=c( 1, 1),mai=c( 0.6, 0.6, 0.6, 0.6))
plot(pred.temp, zlab= "Effect", xlab= "DinuralTemperature (℃)",ylab= "Lag (days)")
par(mfrow=c( 1, 2),mai=c( 0.9, 0.9, 0.7, 0.7))
plot(pred.temp, "slices",var= 5,xlim=c( 0, 15),cex.main= 2.0,
ci.arg=list(density= 50,col=grey( 0.5)),
xlab= "Lag time, (day)",
ylab= "Effect at temperature 5℃",cex.lab= 1.8,
col= 1,lwd= 2)
plot(pred.temp, "slices",lag= 10,cex.main= 2.0,
ci.arg=list(density= 50,col=grey( 0.5)),
xlab= "DinuralTemperature (℃)",
ylab= "Change of XX at lag10",cex.lab= 1.8,
col= 1,lwd= 2)
par(mfrow=c( 1, 1),mai=c( 0.9, 0.9, 0.7, 0.7))
plot(pred.temp,lag=14,main= "Exposure–lag–response",cumul= TRUE,cex.main= 1.8,
xlab= "DinuralTemperature (℃)",ci.arg=list(density= 50,col=grey( 0.5)),col= 1,lwd= 2,
ylab= "Effect of XX",cex.lab= 1.5,lab=c( 8, 5, 5))
#结果如下