predict.serp: Prediction from fitted serp model

View source: R/serp.method.R

predict.serpR Documentation

Prediction from fitted serp model

Description

This function takes a fitted serp object produced by serp() and produces predicted values. Type of predictions returned include response, link and class. Prediction is also possible with new set of values having the same column names as in the original values used for the model fit.

Usage

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

Arguments

object

An object of class serp.

type

could be any of these: response, link or terms.

newdata

fresh dataset with all relevant variables.

...

additional arguments.

Value

A vector of predicted classes with type equal to 'class' or a dataframe of predicted values for type equal to 'response' and 'link'.

See Also

anova.serp, summary.serp, confint.serp, vcov.serp

Examples

library(serp)
m <- serp(rating ~ temp + contact, slope = "penalize",
           reverse = TRUE, link = "logit", tuneMethod = "user",
           lambda = 1, data = wine)

head(predict(m, type = "link"))
head(predict(m, type = "response"))
predict(m, type = "class")

n.wine <- wine[1:20,]
predict(m, newdata = n.wine, type = "class")


serp documentation built on March 18, 2022, 6:33 p.m.