predict.KERE: make predictions from a "KERE" object.

Description Usage Arguments Details Value Author(s) References Examples

View source: R/predict.KERE.R

Description

Similar to other predict methods, this functions predicts fitted values and class labels from a fitted KERE object.

Usage

1
2
## S3 method for class 'KERE'
predict(object, kern, x, newx,...)

Arguments

object

fitted KERE model object.

kern

the built-in kernel classes in KERE. Objects can be created by calling the rbfdot, polydot, tanhdot, vanilladot, anovadot, besseldot, laplacedot, splinedot functions etc. (see example.)

x

the original design matrix for training KERE.

newx

matrix of new values for x at which predictions are to be made. NOTE: newx must be a matrix with each row as an observation. predict function does not accept a vector or other formats of newx.

...

other parameters to predict function.

Details

The fitted α_0 + K * α at newx is returned as a size nrow(newx)*length(lambda) matrix for various lambda values where the KERE model was fitted.

Value

The fitted α_0 + K * α is returned as a size nrow(newx)*length(lambda) matrix. The row represents the index for observations of newx. The column represents the index for the lambda sequence.

Author(s)

Yi Yang, Teng Zhang and Hui Zou
Maintainer: Yi Yang <[email protected]>

References

Y. Yang, T. Zhang, and H. Zou. (2017) "Flexible Expectile Regression in Reproducing Kernel Hilbert Space." Technometrics. Accepted.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# create data
N <- 100
X1 <- runif(N)
X2 <- 2*runif(N)
X3 <- 3*runif(N)
SNR <- 10 # signal-to-noise ratio
Y <- X1**1.5 + 2 * (X2**.5) + X1*X3
sigma <- sqrt(var(Y)/SNR)
Y <- Y + X2*rnorm(N,0,sigma)
X <- cbind(X1,X2,X3)

# set gaussian kernel 
kern <- rbfdot(sigma=0.1)

# define lambda sequence
lambda <- exp(seq(log(0.5),log(0.01),len=10))

# run KERE
m1 <- KERE(x=X, y=Y, kern=kern, lambda = lambda, omega = 0.5) 

# create newx for prediction
N1 <- 5
X1 <- runif(N1)
X2 <- 2*runif(N1)
X3 <- 3*runif(N1)
newx <- cbind(X1,X2,X3)

# make prediction
p1 <- predict.KERE(m1, kern, X, newx)
p1

emeryyi/KERE documentation built on Sept. 27, 2017, 1:30 a.m.