Description Usage Arguments Details Value References Examples
Fit a parametric model of age-dependent antibody acquisition (and loss)
1 |
logAb |
Log antibody level (numeric) |
Age |
Age of the individual at the time of measurement (numeric) |
type |
Specify type of model to fit – either |
print |
Logical. Print parameter estimates? |
Yman2016
estimates rates of antibody acquisision (alpha) and loss (r) using maximum likelihood under a parametric model that assumes constant rates of acquisition and loss, and that antibody levels follow a log-normal distribution. The function also estimates nuissance parameter (sigma, the standard deviation of the log-normal distribution). Future updates may include the changepoint and linear decrease models from the original paper
Returns an object of class Yman2016
that is just the maximum likelihood fit results passed from optim.
Yman V, White MT, Rono J, Arcà B, Osier FH, Troye-Blomberg M, et al. Antibody acquisition models: A new tool for serological surveillance of malaria transmission intensity. Sci Rep. ; 2016;6: 19472. (http://www.nature.com/articles/srep19472)
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 | ## Not run:
# simulate data assuming the Yman 2016 model is the truth
set.seed(1234)
age <- runif(1000,min=1,max=20)
alpha <- 0.5
r <- 0.07
sigma <- log(1.7)
abtrue <- (alpha/r)*(1-exp(-r*age))
abobs <- exp( log(abtrue) +rnorm(length(age),mean=0,sd=sigma) )
# Fit the model and obtain predictions
X <- data.frame(age=age)
Y <- log(abobs)
yman2016fit <- Yman2016(logAb=Y,Age=X$Age)
pY <- predict(yman2016fit$fit,newdata=X)
# compare against truth
cbind(c(alpha,r,sigma),yman2016fit$fit$object$par)
# figure (not run)
# plot(age,log(abobs),cex=0.25,col="gray40",pch=16)
# lines(age[order(age)],log(abtrue[order(age)]),lwd=3,lty=2)
# lines(age[order(age)],pY[order(age)],lwd=1)
# super learner fit
# (note that it selects Yman 2016 under
# conditions where it models the truth)
SL.library <- c("SL.glm","SL.loess","SL.Yman2016")
SLfit <- SuperLearner(Y=log(abobs),X=data.frame(age=age),SL.library=SL.library)
SLfit
# The Yman 2016 model can only use age, not additional covariates,
# so it will throw a warning if X includes more than 1 covariate
# and it will assume that the first column of X is age
SLfit2 <- SuperLearner(Y=log(abobs),X=data.frame(age=age,age2=age^2),SL.library=SL.library)
SLfit2
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.