predict.qrmix: Predict Method for qrmix Fits

Description Usage Arguments Value Examples

View source: R/predictqrmix.R

Description

Obtains clusters, predictions, or residuals from a fitted qrmix object.

Usage

1
2
## S3 method for class 'qrmix'
predict(object, newdata = NULL, type = "clusters", ...)

Arguments

object

a fitted object of class "qrmix".

newdata

optional data frame for which clusters, predictions, or residuals will be obtained from the qrmix fitted object. If omitted, the training values will be used.

type

the type of prediction. type = "clusters" (default value) for predicted clusters, "yhat" for the response predicted value corresponding to the predicted cluste, "residuals" for the residuals corresponding to the response predicted values.

...

other argumets passed to other methods.

Value

A vector with predicted clusters, responses, or residuals, depending on type.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(blood.pressure)

set.seed(8)
sampleInd = sort(sample(1:500, 400))
bpSample1 = blood.pressure[sampleInd,]
bpSample2 = blood.pressure[-sampleInd,]

mod1 = qrmix(bmi ~ ., data = bpSample1, k = 3)

#Cluster assigned to the training values
predict(mod1)

#Residuals corresponding to the response predicted values from mod1 for new data
predict(mod1, newdata = bpSample2, type = "residuals")

qrmix documentation built on May 2, 2019, 11:04 a.m.

Related to predict.qrmix in qrmix...