Learn R Programming

cxreg (version 1.0.0)

coef.classo: Extract coefficients from a classo object

Description

Similar to other predict methods, this functions predicts fitted values, coefficients and more from a fitted "classo" object.

Usage

# S3 method for classo
coef(object, s = NULL, exact = FALSE, ...)

# S3 method for classo predict( object, newx, s = NULL, type = c("response", "coefficients", "nonzero"), exact = FALSE, ... )

Value

The object returned depends on type.

Arguments

object

Fitted "classo" model object.

s

Value(s) of the penalty parameter lambda at which predictions are required. Default is the entire sequence used to create the model.

exact

This argument is relevant only when predictions are made at values of s (lambda) different from those used in the fitting of the original model. If exact=FALSE (default), then the predict function uses linear interpolation to make predictions for values of s (lambda) that do not coincide with those used in the fitting algorithm. While this is often a good approximation, it can sometimes be a bit coarse. With exact=TRUE, these different values of s are merged (and sorted) with object$lambda, and the model is refit before predictions are made. In this case, it is required to supply the original data x= and y= as additional named arguments to predict() or coef(). The workhorse predict.classo() needs to update the model, and so needs the data used to create it. The same is true of weights if these were used in the original call. Failure to do so will result in an error. type="nonzero")

...

This is the mechanism for passing arguments like x= when exact=TRUE; seeexact argument.

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

type

Type of prediction required. Type "link" givee the fitted values for "gaussian". Type "response" is equivalent to type "link". 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.

Author

Younghoon Kim, Navonil Deb, and Sumanta Basu
Maintainer: Younghoon Kim yk748@cornell.edu

Details

This function actually calls NextMethod(). coef(...) is equivalent to predict(type="coefficients",...)

References

Deb, N., Kuceyeski, A. and Basu, S. (2024) Regularized estimation of sparse spectral precision matrices (2024), Preprint, https://arxiv.org/abs/2401.11128.

See Also

classo, and print, and coef methods, and cv.classo.