Learn R Programming

kernlab (version 0.9-33)

kqr-class: Class "kqr"

Description

The Kernel Quantile Regression object class

Arguments

Objects from the Class

Objects can be created by calls of the form new("kqr", ...). or by calling the kqr function

Slots

kernelf:

Object of class "kfunction" contains the kernel function used

kpar:

Object of class "list" contains the kernel parameter used

coef:

Object of class "ANY" containing the model parameters

param:

Object of class "list" contains the cost parameter C and tau parameter used

kcall:

Object of class "list" contains the used function call

terms:

Object of class "ANY" contains the terms representation of the symbolic model used (when using a formula)

xmatrix:

Object of class "input" containing the data matrix used

ymatrix:

Object of class "output" containing the response matrix

fitted:

Object of class "output" containing the fitted values

alpha:

Object of class "listI" containing the computes alpha values

b:

Object of class "numeric" containing the offset of the model.

scaling

Object of class "ANY" containing the scaling coefficients of the data (when case scaled = TRUE is used).

error:

Object of class "numeric" containing the training error

cross:

Object of class "numeric" containing the cross validation error

n.action:

Object of class "ANY" containing the action performed in NA

nclass:

Inherited from class vm, not used in kqr

lev:

Inherited from class vm, not used in kqr

type:

Inherited from class vm, not used in kqr

Methods

coef

signature(object = "kqr"): returns the coefficients (alpha) of the model

alpha

signature(object = "kqr"): returns the alpha vector (identical to coef)

b

signature(object = "kqr"): returns the offset beta of the model.

cross

signature(object = "kqr"): returns the cross validation error

error

signature(object = "kqr"): returns the training error

fitted

signature(object = "vm"): returns the fitted values

kcall

signature(object = "kqr"): returns the call performed

kernelf

signature(object = "kqr"): returns the kernel function used

kpar

signature(object = "kqr"): returns the kernel parameter used

param

signature(object = "kqr"): returns the cost regularization parameter C and tau used

xmatrix

signature(object = "kqr"): returns the data matrix used

ymatrix

signature(object = "kqr"): returns the response matrix used

scaling

signature(object = "kqr"): returns the scaling coefficients of the data (when scaled = TRUE is used)

Author

Alexandros Karatzoglou
alexandros.karatzoglou@ci.tuwien.ac.at

See Also

kqr, vm-class, ksvm-class

Examples

Run this code


# create data
x <- sort(runif(300))
y <- sin(pi*x) + rnorm(300,0,sd=exp(sin(2*pi*x)))

# first calculate the median
qrm <- kqr(x, y, tau = 0.5, C=0.15)

# predict and plot
plot(x, y)
ytest <- predict(qrm, x)
lines(x, ytest, col="blue")

# calculate 0.9 quantile
qrm <- kqr(x, y, tau = 0.9, kernel = "rbfdot",
           kpar = list(sigma = 10), C = 0.15)
ytest <- predict(qrm, x)
lines(x, ytest, col="red")

# print model coefficients and other information
coef(qrm)
b(qrm)
error(qrm)
kernelf(qrm)

Run the code above in your browser using DataLab