predict.linear_regression: Predict from a 'linear_regression'

View source: R/linear_regression-predict.R

predict.linear_regressionR Documentation

Predict from a linear_regression

Description

Predict from a linear_regression

Usage

## S3 method for class 'linear_regression'
predict(object, new_data, type = "numeric", ...)

Arguments

object

A linear_regression object.

new_data

A data frame or matrix of new predictors.

type

A single character. The type of predictions to generate. Valid options are:

  • "numeric" for numeric predictions.

...

Not used, but required for extensibility.

Value

A tibble of predictions. The number of rows in the tibble is guaranteed to be the same as the number of rows in new_data.

Examples

set.seed(0)
data <- simulate_dummy_linear_data()

model <- linear_regression(y~., data, l1=0.05, l2=0.01, frob=0.01, num_comp=3)

new_data <- simulate_dummy_linear_data()

predict(model, new_data, type = "numeric")


jlaria/glasp documentation built on Dec. 5, 2022, 6:42 a.m.