predict.rm_class: Prediction function for the rm_class_model

View source: R/main_functions.R

predict.rm_classR Documentation

Prediction function for the rm_class_model

Description

This function predicts the outcome for a RM object model using new data

Usage

## S4 method for signature 'rm_class'
predict(object,newdata)

Arguments

object

A fitted RM model object of class rm_class.

newdata

A data frame or matrix containing the new data to be predicted.

Value

A vector of predicted outcomes: probabilities in case of 'prob_model = TRUE' and classes in case of 'prob_model = FALSE'.

Examples

# Generating a sample for the simulation
library(randomMachines)
sim_data <- sim_class(n = 75)
sim_new <- sim_class(n = 25)
rm_mod <- randomMachines(y~., train = sim_data)
y_hat <- predict(rm_mod, newdata = sim_new)

randomMachines documentation built on Aug. 8, 2025, 6:15 p.m.