Print a Cross-Validated Parity Regression Model Object
Source:R/print.cv.savvyPR.R
print.cv.savvyPR.RdPrints a summarized output of a fitted cross-validated parity regression model object. It clearly displays the optimal tuning parameters and the resulting estimated coefficients.
Arguments
- x
A fitted model object of class
"cv.savvyPR"returned bycv.savvyPR.- digits
Significant digits to be used in the printout.
- ...
Additional arguments passed to the generic
printfunction.
Value
Invisibly returns a data frame summarizing the cross-validation results, including the parameterization method, number of non-zero coefficients, and optimal tuning parameters.
Details
Print a Cross-Validated Parity Regression Model Object
This function is an S3 method for the generic print function. It formats and prints
the matched call that produced the cv.savvyPR object, followed by a summary data frame.
This summary includes:
The parameterization method used (
"budget"or"target").The number of non-zero coefficients.
Whether an intercept was included.
The optimal tuning value (
val) and/orlambdaparameter, depending on themodel_type(PR1,PR2, orPR3).
Finally, it prints a data frame of the optimally tuned estimated coefficients.
Author
Ziwei Chen, Vali Asimit and Pietro Millossovich
Maintainer: Ziwei Chen <ziwei.chen.3@citystgeorges.ac.uk>
Examples
# \donttest{
# Generate synthetic data
set.seed(123)
n <- 100
p <- 10
x <- matrix(rnorm(n * p), n, p)
beta <- matrix(rnorm(p), p, 1)
y <- x %*% beta + rnorm(n, sd = 0.5)
# Fit and print a cross-validated budget-based parity regression model
cv_fit_budget <- cv.savvyPR(x, y, method = "budget", model_type = "PR3")
print(cv_fit_budget)
#>
#> Call: cv.savvyPR(x = x, y = y, method = "budget", model_type = "PR3")
#>
#> Method Number of Non-Zero Coefficients Intercept Included Fixed Val
#> budget 11 Yes 0
#> Optimal Lambda Value
#> 0
#>
#> Coefficients:
#> Coefficient Estimate
#> (Intercept) 0.0659
#> X1 -0.9956
#> X2 -1.0854
#> X3 0.0103
#> X4 -0.0654
#> X5 -2.6262
#> X6 1.0722
#> X7 0.2621
#> X8 2.3303
#> X9 0.6715
#> X10 -0.4369
# Fit and print a cross-validated target-based parity regression model
cv_fit_target <- cv.savvyPR(x, y, method = "target", model_type = "PR1")
print(cv_fit_target)
#>
#> Call: cv.savvyPR(x = x, y = y, method = "target", model_type = "PR1")
#>
#> Method Number of Non-Zero Coefficients Intercept Included Optimal Val
#> target 11 Yes 0
#> Fixed Lambda Value
#> 0
#>
#> Coefficients:
#> Coefficient Estimate
#> (Intercept) 0.0659
#> X1 -0.9956
#> X2 -1.0854
#> X3 0.0103
#> X4 -0.0654
#> X5 -2.6262
#> X6 1.0722
#> X7 0.2621
#> X8 2.3303
#> X9 0.6715
#> X10 -0.4369
# }