Description Usage Arguments Examples
The use of serological surveys is nowadays a common way to study the epidemiology of many infections. In case a single cross-sectional survey is available, one needs to assume that the disease is in steady state. While reasonable for some infections, this assumption might be untenable for other situations. Models such as the proportional hazards model of Nagelkerke et al. (1999) estimate age- and time-specific prevalence and force of infection from a series of prevalence surveys.
1 |
formula |
A GAM formula, or a list of formulae (see |
family |
This is a family object specifying the distribution and link to use in fitting etc (see |
... |
See |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | library(mgcv)
# Load Dutch Tuberculosis Data
data("TB_NED_6673")
a <- TB_NED_6673$AGE
birthyear <- TB_NED_6673$BRTHYR
x <- birthyear-min(birthyear)
xf <- as.factor(birthyear)
g <- TB_NED_6673$SEX
ts <- a+birthyear
s <- TB_NED_6673$PPD
p <- s/TB_NED_6673$N
f <- TB_NED_6673$N-s
y <- cbind(s,f)
# Model 1 (parametric model) (Ades and Noke)
gamfit <- gam(y~a+x,family=binomial(link="cloglog"))
cbind(sum(gamfit$edf),AIC(gamfit),AIC(gamfit, k = log(nrow(y))))
# Model 2 (parametric model) (Ades and Noke)
gamfit=gam(y~a+x+g,family=binomial(link="cloglog"))
cbind(sum(gamfit$edf),AIC(gamfit),AIC(gamfit, k = log(nrow(y))))
# Model 3 (parametric model) (Ades and Noke)
gamfit=gam(y~a*x+g,family=binomial(link="cloglog"))
cbind(sum(gamfit$edf),sum(gamfit$edf),sum(gamfit$edf),AIC(gamfit),AIC(gamfit, k = log(nrow(y))))
# Model 4 (semi-parametric model) (Nagelkerke)
gamfit=gam(y~s(a)+x,family=binomial(link="cloglog"))
cbind(sum(gamfit$edf),AIC(gamfit),AIC(gamfit, k = log(nrow(y))))
# Model 5 (semi-parametric model) (Nagelkerke)
gamfit=gam(y~s(a)+x+g,family=binomial(link="cloglog"))
cbind(sum(gamfit$edf),AIC(gamfit),AIC(gamfit, k = log(nrow(y))))
# Model 6 (semi-parametric model) (Nagelkerke)
gamfit=gam(y~s(a)+x*g,family=binomial(link="cloglog"))
cbind(sum(gamfit$edf),AIC(gamfit),AIC(gamfit, k = log(nrow(y))))
# Model 7 (non-parametric model)
gamfit=gam(y~s(a)+s(x),family=binomial(link="cloglog"))
cbind(sum(gamfit$edf),AIC(gamfit),AIC(gamfit, k = log(nrow(y))))
# Model 8 (non-parametric model)
gamfit=gam(y~s(a)+s(x)+g,family=binomial(link="cloglog"))
cbind(sum(gamfit$edf),AIC(gamfit),AIC(gamfit, k = log(nrow(y))))
# Model 9 (non-parametric model)
gamfit=gam(y~s(a)+s(x)+s(x,by=g)+g,family=binomial(link="cloglog"))
cbind(sum(gamfit$edf),AIC(gamfit),AIC(gamfit, k = log(nrow(y))))
# Model 10 (non-proportional hazard)
gamfit=gam(y~s(a,x),family=binomial(link="cloglog"))
c(sum(gamfit$edf),AIC(gamfit),AIC(gamfit, k = log(nrow(y))))
# Model 11 (non-proportional hazard)
gamfit=gam(y~s(a,x)+g,family=binomial(link="cloglog"))
cbind(sum(gamfit$edf),AIC(gamfit),AIC(gamfit, k = log(nrow(y))))
# Model 12 (non-proportional hazard)
gamfit=gam(y~s(a,x)+g+s(a,x,by=g),family=binomial(link="cloglog"))
c(sum(gamfit$edf),AIC(gamfit),AIC(gamfit, k = log(nrow(y))))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.