predict.lasso_screenr: An S3 Method to Compute Predicted Probabilities of Positive...

View source: R/predict-methods.R

predict.lasso_screenrR Documentation

An S3 Method to Compute Predicted Probabilities of Positive Test Results

Description

predict.lasso_screenr computes predicted probabilities of positive test results from new data.

Usage

## S3 method for class 'lasso_screenr'
predict(object = NULL, ..., newdata = NULL)

Arguments

object

an object of class lasso_screenr produced by `lasso_screenr`.

...

optional arguments to predict methods.

newdata

new dataframe from which predicted probabilities of positive test results are desired. The dataframe must contain values of the same response variables and covariates that were used to obtain obj.

Details

This method is a convenience wrapper for `glmpath::predict.glmpath`.

Value

predict.lasso_screenr returns (invisibly) a dataframe augmenting the complete cases in newdata with the predicted probabilities of positive test results phat_minAIC and phat_minBIC from the models that produced the minimum AIC and BIC, respectively.

Examples

attach(uniobj1)
## Get some new observations
new_corns <- data.frame(ID = c("Alice D.", "Bernie P."),
                        testresult = c(NA, NA),
                        Q1 = c(0, 0), Q2 = c(0, 0), Q3 = c(0, 1), Q4 = c(0, 0),
                        Q5 = c(0, 1), Q6 = c(0, 1), Q7 = c(0, 1))
## Predict the probabilities of testing positive for the new subjects
print(predict(uniobj1, newdata = new_corns))

sgutreuter/screenr documentation built on Nov. 20, 2022, 2:41 a.m.