| predict.cosso {cosso} | R Documentation | 
Make predictions or extract coefficients from a cosso model
Description
Make prediction for future observations or extract the model parameters at a particular smoothing parameter.
Usage
 
## S3 method for class 'cosso'
predict(object,xnew,M,type=c("fit","coefficients","nonzero"),eps=1e-7,...) 
Arguments
object | 
 a cosso object.  | 
xnew | 
 matrix of new values for   | 
M | 
 a smoothing parameter value. M should be taken between 0 and p. If not provided, a cross-validation procedure will be carried out to select an appropriate value.  | 
type | 
 if   | 
eps | 
 an effective zero, default is   | 
... | 
 additional arguments for predict function.  | 
Value
The object returned depends on type.
When type="fit", predicted 
eta
 function value will be given at the new design points xnew.
When type="coefficients", three sets of coefficients will be returned.
Intercept | 
 the estimated intercept. If   | 
coefs | 
 the estimated coefficients for kernel representers.  | 
theta | 
 the estimated scale parameters for each functional component.  | 
When type="nonzero", a list of the indices of the nonconstant functional components will be returned.
Author(s)
Hao Helen Zhang and Chen-Yen Lin
See Also
Examples
 
## Gaussian
set.seed(20130310)
x=cbind(rbinom(200,1,.7),matrix(runif(200*7,0,1),nc=7))
y=x[,1]+sin(2*pi*x[,2])+5*(x[,4]-0.4)^2+rnorm(200,0,1)
G.Obj=cosso(x,y,family="Gaussian")
predict.cosso(G.Obj,M=2,type="nonzero")
predict.cosso(G.Obj,xnew=x[1:3,],M=2,type="fit")
## Clean up
rm(list=ls())
## Not run: 
## Binomial
set.seed(20130310)
x=cbind(rbinom(200,1,.7),matrix(runif(200*9,0,1),nc=9))
trueProb=1/(1+exp(-x[,1]-sin(2*pi*x[,2])-5*(x[,4]-0.4)^2))
y=rbinom(200,1,trueProb)
B.Obj=cosso(x,y,family="Bin") 
f.hat=predict.cosso(B.Obj,xnew=x,M=2,type="fit")
prob.hat=1/(1+exp(-f.hat))
## Clean up
rm(list=ls())
## End(Not run)