predict.serp: Prediction from fitted serp model

Description Usage Arguments Value See Also Examples

View source: R/serp.method.R

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

1
2
## 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, errorMetrics

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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 Nov. 8, 2021, 1:08 a.m.