Skip to contents

Extracts the estimated coefficients from a fitted parity regression model object. It seamlessly handles models fitted using either the "budget" or "target" parameterization method.

Usage

# S3 method for class 'savvyPR'
coef(object, ...)

Arguments

object

A fitted model object of class savvyPR.

...

Additional arguments passed to the predict.savvyPR method.

Value

A named numeric vector of the estimated coefficients from the fitted model. If the model was fitted with an intercept, it will be included as the first element.

Details

Extract Coefficients From a Parity Regression Model Object

This function is an S3 method for the generic coef function. It extracts the estimated coefficients of the fitted model. The extraction is internally delegated to the predict.savvyPR method with type = "coefficients".

Author

Ziwei Chen, Vali Asimit and Pietro Millossovich
Maintainer: Ziwei Chen <ziwei.chen.3@citystgeorges.ac.uk>

Examples

# Generate synthetic data
set.seed(123)
x <- matrix(rnorm(100 * 10), 100, 10)
y <- rnorm(100)

# Example 1: Extract coefficients from a Budget-based model
model_budget <- savvyPR(x, y, method = "budget", val = 0.05)
coef(model_budget)
#> (Intercept)          V1          V2          V3          V4          V5 
#>   0.1054051   0.3243411  -0.2521900  -0.3299029   0.2870973   0.3710660 
#>          V6          V7          V8          V9         V10 
#>  -0.3065163   0.3189412   0.3130406  -0.2516485   0.3060736 

# Example 2: Extract coefficients from a Target-based model
model_target <- savvyPR(x, y, method = "target", val = 1)
coef(model_target)
#> (Intercept)          V1          V2          V3          V4          V5 
#>  0.07363581  0.70880475 -0.58176746 -0.65996757  0.56429331  0.82128968 
#>          V6          V7          V8          V9         V10 
#> -0.68973238  0.67814765  0.64189157 -0.54809389  0.60917162