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

View source: R/predict-methods.R

predict.logreg_screenrR Documentation

An S3 Method to Compute Predicted Probabilities of Positive Test Results

Description

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

Usage

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

Arguments

object

an object of class logreg_screenr produced by `logreg_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 object.

Details

This method is a convenience wrapper for `stats::predict.glm`.

Value

predict.logreg_screenr returns (invisibly) a dataframe augmenting newdata with the predicted probabilities of positive test results phat.

Examples

attach(uniobj2)
## 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, 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(uniobj2, newdata = new_corns))

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