predict: Prediction based on SMLE screening and selection

predict.smleR Documentation

Prediction based on SMLE screening and selection

Description

For a model object of class 'smle' or 'selection', this function returns the predicted response values after re-fitting the model using glm.

Usage

## S3 method for class 'smle'
predict(object, newdata = NULL, type = c("link", "response", "terms"), ...)

## S3 method for class 'selection'
predict(object, newdata = NULL, type = c("link", "response", "terms"), ...)

Arguments

object

A 'smle' or 'selection' object.

newdata

Matrix of new values for the features at which predictions are to be made. If omitted, the fitted linear predictors are used.

type

The type of prediction required by predict.glm().

...

Further arguments passed to predict.glm().

Value

A prediction vector with length equal to the number of rows of newdata.

Examples


set.seed(1)
Data_sim <- Gen_Data(n = 420, p = 1000, sigma = 0.5, family = "gaussian")
train_X <- Data_sim$X[1:400,]; test_X <- Data_sim$X[401:420,]
train_Y <- Data_sim$Y[1:400]; test_Y <- Data_sim$Y[401:420]
fit1 <- SMLE(Y = train_Y, X = train_X, family = "gaussian", k = 10)

#Fitted responses vs true responses in training data
predict(fit1)[1:10]
train_Y[1:10]

#Predicted responses vs true responses in testing data
predict(fit1, newdata = test_X)
test_Y




SMLE documentation built on Jan. 22, 2023, 1:55 a.m.