summary() provides summary statistics regarding the performance of cvCovEst() and can be used for diagnostic plotting.

# S3 method for cvCovEst
summary(
  object,
  dat_orig,
  summ_fun = c("cvRiskByClass", "bestInClass", "worstInClass", "hyperRisk"),
  ...
)

Arguments

object

A named list of class "cvCovEst".

dat_orig

The numeric data.frame, matrix, or similar object originally passed to cvCovEst().

summ_fun

A character vector specifying which summaries to output. See Details for function descriptions.

...

Additional arguments passed to summary()These are not explicitly used and should be ignored by the user.

Value

A named list where each element corresponds to the output of of the requested summaries.

Details

summary() accepts four different choices for the summ_fun argument. The choices are:

  • "cvRiskByClass" - Returns the minimum, first quartile, median, third quartile, and maximum of the cross-validated risk associated with each class of estimator passed to cvCovEst().

  • "bestInClass" - Returns the specific hyperparameters, if applicable, of the best performing estimator within each class along with other metrics.

  • "worstInClass" - Returns the specific hyperparameters, if applicable, of the worst performing estimator within each class along with other metrics.

  • "hyperRisk" - For estimators that take hyperparameters as arguments, this function returns the hyperparameters associated with the minimum, first quartile, median, third quartile, and maximum of the cross-validated risk within each class of estimator. Each class has its own tibble, which are returned as a list.

Examples

cv_dat <- cvCovEst(
  dat = mtcars,
  estimators = c(
    linearShrinkEst, thresholdingEst, sampleCovEst
  ),
  estimator_params = list(
    linearShrinkEst = list(alpha = seq(0.1, 0.9, 0.1)),
    thresholdingEst = list(gamma = seq(0.1, 0.9, 0.1))
  ),
  center = TRUE,
  scale = TRUE
)

summary(cv_dat, mtcars)
#> $cvRiskByClass
#> # A tibble: 3 × 7
#>   Estimator              Min         Q1     Median         Q3        Max    Mean
#>   <chr>                <dbl>      <dbl>      <dbl>      <dbl>      <dbl>   <dbl>
#> 1 sampleCovEst    184229575. 184229575. 184229575. 184229575. 184229575.  1.84e8
#> 2 thresholdingEst 184229575. 184229575. 184229577. 184229584. 184229584.  1.84e8
#> 3 linearShrinkEst 198978118. 220774488. 285510709. 435473742. 570688231.  3.52e8
#> 
#> $bestInClass
#> # A tibble: 3 × 6
#>   estimator       hyperparameter          cv_risk cond_num sign  sparsity
#>   <chr>           <chr>                     <dbl>    <dbl> <chr>    <dbl>
#> 1 sampleCovEst    hyperparameters = NA 184229575.   473000 PD       0    
#> 2 thresholdingEst gamma = 0.1          184229575. -1400000 IND      0.083
#> 3 linearShrinkEst alpha = 0.9          198978118.   124000 PD       0    
#> 
#> $worstInClass
#> # A tibble: 3 × 6
#>   estimator       hyperparameter          cv_risk cond_num sign  sparsity
#>   <chr>           <chr>                     <dbl>    <dbl> <chr>    <dbl>
#> 1 sampleCovEst    hyperparameters = NA 184229575.   473000 PD        0   
#> 2 thresholdingEst gamma = 0.8          184229584.   -11400 IND       0.43
#> 3 linearShrinkEst alpha = 0.1          570688231.     2060 PD        0   
#> 
#> $hyperRisk
#> $hyperRisk$thresholdingEst
#> # A tibble: 5 × 3
#>   hyperparameters cv_risk   stat  
#>   <chr>           <chr>     <chr> 
#> 1 gamma = 0.1     184229575 min   
#> 2 gamma = 0.1     184229575 Q1    
#> 3 gamma = 0.3     184229577 median
#> 4 gamma = 0.7     184229584 Q3    
#> 5 gamma = 0.7     184229584 max   
#> 
#> $hyperRisk$linearShrinkEst
#> # A tibble: 5 × 3
#>   hyperparameters cv_risk   stat  
#>   <chr>           <chr>     <chr> 
#> 1 alpha = 0.9     198978118 min   
#> 2 alpha = 0.8     220774488 Q1    
#> 3 alpha = 0.6     285510709 median
#> 4 alpha = 0.3     435473742 Q3    
#> 5 alpha = 0.1     570688231 max   
#> 
#>