predict.qrmix {qrmix}R Documentation

Predict Method for qrmix Fits

Description

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

Usage

## 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


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")


[Package qrmix version 0.9.0 Index]