Learn R Programming

fastcox (version 1.1.1)

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

Description

Similar to other predict methods, this functions predicts fitted values, link function and more from a fitted cocktail object. This function is modified based on the predict function from the glmnet package.

Usage

"predict"(object,newx,s=NULL,type=c("link","response","coefficients","nonzero"),...)

Arguments

object
fitted cocktail model object.
newx
matrix of new values for x at which predictions are to be made. Must be a matrix. This argument is not used for type=c("coefficients","nonzero")
s
value(s) of the penalty parameter lambda at which predictions are required. Default is the entire sequence used to create the model.
type
type of prediction required.
  • Type "link" gives the linear predictors for Cox's model.
  • Type "response" gives the fitted relative-risk for Cox's model.
  • Type "coefficients" computes the coefficients at the requested values for s.
  • Type "nonzero" returns a list of the indices of the nonzero coefficients for each value of s.
...
Not used. Other arguments to predict.

Value

Details

s is the new vector at which predictions are requested. If s is not in the lambda sequence used for fitting the model, the predict function will use linear interpolation to make predictions. The new values are interpolated using a fraction of predicted values from both left and right lambda indices.

References

Yang, Y. and Zou, H. (2012), "A Cocktail Algorithm for Solving The Elastic Net Penalized Cox's Regression in High Dimensions", Statistics and Its Interface. http://code.google.com/p/fastcox/

Friedman, J., Hastie, T. and Tibshirani, R. (2008) "Regularization Paths for Generalized Linear Models via Coordinate Descent", http://www.stanford.edu/~hastie/Papers/glmnet.pdf Journal of Statistical Software, Vol. 33(1), 1-22 Feb 2010 http://www.jstatsoft.org/v33/i01/ Simon, N., Friedman, J., Hastie, T., Tibshirani, R. (2011) "Regularization Paths for Cox's Proportional Hazards Model via Coordinate Descent", Journal of Statistical Software, Vol. 39(5) 1-13 http://www.jstatsoft.org/v39/i05/

See Also

coef method

Examples

Run this code
data(FHT)
m1<-cocktail(x=FHT$x,y=FHT$y,d=FHT$status,alpha=0.5)
predict(m1,type="nonzero")
predict(m1,s=c(0.01,0.005),type="coefficients")
predict(m1,newx=FHT$x[1:5,],type="response")
predict(m1,newx=FHT$x[1:3,],s=0.01,type="link")

Run the code above in your browser using DataLab