View source: R/coef.cv.savvyPR.R
| coef.cv.savvyPR | R Documentation |
Extracts the estimated coefficients corresponding to the optimal tuning parameters
from a fitted cross-validated parity regression model object. It seamlessly handles models
optimized using either the "budget" or "target" parameterization method.
## S3 method for class 'cv.savvyPR'
coef(object, ...)
object |
A fitted model object of class |
... |
Additional arguments passed to the |
Extract Coefficients From a Cross-Validated Parity Regression Model Object
This function is an S3 method for the generic coef function. It extracts the coefficients
of the optimal model identified during the cross-validation procedure. The extraction is
internally delegated to the predict.cv.savvyPR method with type = "coefficients".
A named numeric vector of the estimated coefficients from the optimally tuned model. If the model was fitted with an intercept, it will be included as the first element.
Ziwei Chen, Vali Asimit and Pietro Millossovich
Maintainer: Ziwei Chen <ziwei.chen.3@citystgeorges.ac.uk>
cv.savvyPR, predict.cv.savvyPR
# Generate synthetic data
set.seed(123)
x <- matrix(rnorm(100 * 10), 100, 10)
y <- rnorm(100)
# Example 1: Extract coefficients from a Budget-based CV model
cv_model_budget <- cv.savvyPR(x, y, method = "budget", model_type = "PR3")
coef(cv_model_budget)
# Example 2: Extract coefficients from a Target-based CV model
cv_model_target <- cv.savvyPR(x, y, method = "target", model_type = "PR1")
coef(cv_model_target)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.