Learn R Programming

VizOR (version 0.8-5)

predReg: Registry Ensemble Prediction

Description

Generate an rms:Predict object or data frame for an ensemble of simulated disease registries

Usage

predReg(genReg, N, M = 100, fit = NULL, adjust.to = fit$Design$limits["Adjust to", ], do.pred = function(df) { fit.call <- fit$call fit.call$data <- quote(df) fit <- eval(fit.call) fit$Design$limits["Adjust to", names(adjust.to)] <- adjust.to if(is(fit, "lrm")) Predict(fit, fun = plogis) else Predict(fit) }, ...)

Arguments

genReg
A function that returns a simulated registry dataset, taking as its first parameter the desired size of the simulated registry, and possibly other parameters passed through via the ... arg
N
Size of generated registries
M
Size of the ensemble
fit
A fitted model usually intended to serve as a template for a model to be fitted to the simulated registries. This may be NULL when do.pred is provided explicitly in the call
adjust.to
A list of adjust-to values for the fitted models, defaulting to the adjust-to parameters of fit
do.pred
A function to be run on the data generated during each iteration of the simulation, generating either an rms:Predict object, or a (usually, named) atomic vector
...
Additional parameters passed to genReg

Value

Depending on the return type of do.pred, either an rms:Predict object containing ensemble-averaged predictions with confidence bounds reflecting their estimated ensemble variance, or else a data frame collecting the vector returned by do.pred

Details

Given a function for generating a simulated disease registry, this function generates an ensemble of such registries. It then returns an rms:Predict object that contains ensemble-averaged predictions and confidence bounds.