Description Usage Arguments Details Value See Also Examples
A convenience wrapper for CV.SuperLearner
for antibody measurements.
1 2 3 |
Y |
Antibody measurement. Must be a numeric vector. |
X |
A vector, matrix, or data.frame of covariates for each individual used to predict antibody levels |
id |
An optional cluster or repeated measures id variable. For cross-validation splits, |
V |
Number of folds to use in the cross validation (default is 10) |
SL.library |
Library of algorithms to include in the ensemble (see the |
RFnodesize |
Optional argument to specify a range of minimum node sizes for the random forest algorithm. If |
gamdf |
Optional argument to specify a range of degrees of freedom for natural smoothing splines in a generalized additive model. If |
The SuperLearner function builds a estimator, but does not contain an estimate on the performance of the estimator. Various methods exist for estimator performance evaluation. If you are familiar with the super learner algorithm, it should be no surprise we recommend using cross-validation to evaluate the honest performance of the super learner estimator. The function cvSLAb
provides a convenient wrapper for the CV.SuperLearner
routine to compute the V-fold cross-validated risk estimate for the super learner (and all algorithms in SL.library
for comparison). The wrapper adds convenience by restricting the dataset to complete cases, transforming the covariate matrix (W
) into a data.frame, and allowing the user to tune parameters in the Random Forest and GAM libraries if they are included in SL.library
. It assumes a continuous outcome (family=gaussian()
), but can be run on binary outcomes without problems.
This function returns an object of class CV.SuperLearner
(see the SuperLearner
package for details)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Not run:
# load the Garki project serology data, subset to round 5 intervention
data("garki_sero")
garki_sero$village <- factor(garki_sero$village)
garki_sero$sex <- factor(garki_sero$sex)
garki_sero$tr01 <- ifelse(garki_sero$tr=="Intervention",1,0)
d <- subset(garki_sero,serosvy==5 & tr=="Intervention")
# fit the cross-validated super learner
# with just Age as the predictor
set.seed(62522)
CVfit <- cvSLAb(Y=log10(d$ifatpftitre+1),X=data.frame(Age=d$ageyrs),id=d$id)
# plot cross-validated MSE ("Risk")
plot(CVfit)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.