predict.OR {flexOR}R Documentation

predict.OR : Predict Method for OR Objects

Description

Predicts values using a fitted OR model.

Usage

## S3 method for class 'OR'
predict(
  object,
  predictor,
  prob = NULL,
  ref.value = NULL,
  conf.level = 0.95,
  prediction.values = NULL,
  round.x = NULL,
  ref.label = NULL,
  ...
)

Arguments

object

An object of class "OR."

predictor

The predictor variable for which you want to make predictions.

prob

Probability value for prediction. Use 0 for point prediction, 0.5 for median, or a custom value between 0 and 1.

ref.value

Optional custom prediction value (use with prob=NULL).

conf.level

Confidence level for prediction intervals (default is 0.95).

prediction.values

Vector of specific prediction values to calculate.

round.x

Number of decimal places to round the prediction values (default is 5).

ref.label

Label for the predictor variable in the output (optional).

...

Additional arguments (not used in this function).

Details

This function predicts values and prediction intervals using a fitted OR model.

Value

A matrix with predicted values and prediction intervals.

Examples

library(gam);

# Load the Pima Indians Diabetes dataset
data(PimaIndiansDiabetes2, package="mlbench");

# Calculate smooth odds ratios using flexOR
mod1 <- flexOR(
  data=PimaIndiansDiabetes2,
  response="diabetes",
  formula= ~ s(age) + s(mass) + s(pedigree) + pressure + glucose
);

# Predict the probabilities using predict.OR
predict(mod1, predictor="age", ref.value=40) 


[Package flexOR version 1.0.0 Index]