Learn R Programming

randomMachines (version 0.1.1)

predict.rm_reg: Prediction function for the rm_reg_model

Description

This function predicts the outcome for a RM object model using new data for continuous \(y\)

Usage

# S4 method for rm_reg
predict(object,newdata)

Value

Predicted values newdata object from the Random Machines model.

Arguments

object

A fitted RM model object of class rm_reg.

newdata

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

Examples

Run this code
# Generating a sample for the simulation
library(randomMachines)
sim_data <- sim_reg1(n = 75)
sim_new <- sim_reg1(n = 25)
rm_mod_reg <- randomMachines(y~., train = sim_data)
y_hat <- predict(rm_mod_reg, newdata = sim_new)

Run the code above in your browser using DataLab