Function that visualizes the regularization paths of the nonredundant elements of a regularized precision matrix against the (range of the) penalty parameter.

ridgePathS(
  S,
  lambdaMin,
  lambdaMax,
  step,
  type = "Alt",
  target = default.target(S),
  plotType = "pcor",
  diag = FALSE,
  vertical = FALSE,
  value,
  verbose = TRUE
)

Arguments

S

Sample covariance matrix.

lambdaMin

A numeric giving the minimum value for the penalty parameter.

lambdaMax

A numeric giving the maximum value for the penalty parameter.

step

An integer determining the number of steps in moving through the grid [lambdaMin, lambdaMax].

type

A character indicating the type of ridge estimator to be used. Must be one of: "Alt", "ArchI", "ArchII".

target

A target matrix (in precision terms) for Type I ridge estimators.

plotType

A character indicating the type of element for which a visualization of the regularization paths is desired. Must be one of: "pcor", "cor", "cov", "prec".

diag

A logical indicating if the diagonal elements should be retained for visualization.

vertical

A logical indicating if output graph should come with a vertical line at a pre-specified value for the penalty parameter.

value

A numeric indicating a pre-specified value for the penalty parameter.

verbose

A logical indicating if information on progress should be printed on screen.

Details

The function visualizes the regularization path of the individual elements of a regularized precision matrix against the penalty parameter. The range of the penalty parameter is given by [lambdaMin,lambdaMax]. The penalty parameter must be positive such that lambdaMin must be a positive scalar. The maximum allowable value of lambdaMax depends on the type of ridge estimator employed. For details on the type of ridge estimator one may use (one of: "Alt", "ArchI", "ArchII") see ridgeP.

Regularization paths may be visualized for (partial) correlations, covariances and precision elements. The type of element for which a visualization of the regularization paths is desired can be indicated by the argument plotType. When vertical = TRUE a vertical line is added at the constant value. This option can be used to assess whereabouts the optimal penalty obtained by, e.g., the routines optPenalty.LOOCV or optPenalty.aLOOCV, finds itself along the regularization path.

Author

Wessel N. van Wieringen, Carel F.W. Peeters <carel.peeters@wur.nl>

Examples


## Obtain some (high-dimensional) data
p = 25
n = 10
set.seed(333)
X = matrix(rnorm(n*p), nrow = n, ncol = p)
colnames(X)[1:25] = letters[1:25]
Cx <- covML(X)

## Visualize regularization paths
ridgePathS(Cx, .001, 50, 200, plotType = "pcor")
#> Perform input checks... 
#> Calculating... 
#> lambda = 0.001 done 
#> lambda = 0.252251256281407 done 
#> lambda = 0.503502512562814 done 
#> lambda = 0.754753768844221 done 
#> lambda = 1.00600502512563 done 
#> lambda = 1.25725628140704 done 
#> lambda = 1.50850753768844 done 
#> lambda = 1.75975879396985 done 
#> lambda = 2.01101005025126 done 
#> lambda = 2.26226130653266 done 
#> lambda = 2.51351256281407 done 
#> lambda = 2.76476381909548 done 
#> lambda = 3.01601507537688 done 
#> lambda = 3.26726633165829 done 
#> lambda = 3.5185175879397 done 
#> lambda = 3.76976884422111 done 
#> lambda = 4.02102010050251 done 
#> lambda = 4.27227135678392 done 
#> lambda = 4.52352261306533 done 
#> lambda = 4.77477386934673 done 
#> lambda = 5.02602512562814 done 
#> lambda = 5.27727638190955 done 
#> lambda = 5.52852763819096 done 
#> lambda = 5.77977889447236 done 
#> lambda = 6.03103015075377 done 
#> lambda = 6.28228140703518 done 
#> lambda = 6.53353266331658 done 
#> lambda = 6.78478391959799 done 
#> lambda = 7.0360351758794 done 
#> lambda = 7.2872864321608 done 
#> lambda = 7.53853768844221 done 
#> lambda = 7.78978894472362 done 
#> lambda = 8.04104020100502 done 
#> lambda = 8.29229145728643 done 
#> lambda = 8.54354271356784 done 
#> lambda = 8.79479396984925 done 
#> lambda = 9.04604522613065 done 
#> lambda = 9.29729648241206 done 
#> lambda = 9.54854773869347 done 
#> lambda = 9.79979899497487 done 
#> lambda = 10.0510502512563 done 
#> lambda = 10.3023015075377 done 
#> lambda = 10.5535527638191 done 
#> lambda = 10.8048040201005 done 
#> lambda = 11.0560552763819 done 
#> lambda = 11.3073065326633 done 
#> lambda = 11.5585577889447 done 
#> lambda = 11.8098090452261 done 
#> lambda = 12.0610603015075 done 
#> lambda = 12.3123115577889 done 
#> lambda = 12.5635628140704 done 
#> lambda = 12.8148140703518 done 
#> lambda = 13.0660653266332 done 
#> lambda = 13.3173165829146 done 
#> lambda = 13.568567839196 done 
#> lambda = 13.8198190954774 done 
#> lambda = 14.0710703517588 done 
#> lambda = 14.3223216080402 done 
#> lambda = 14.5735728643216 done 
#> lambda = 14.824824120603 done 
#> lambda = 15.0760753768844 done 
#> lambda = 15.3273266331658 done 
#> lambda = 15.5785778894472 done 
#> lambda = 15.8298291457286 done 
#> lambda = 16.0810804020101 done 
#> lambda = 16.3323316582915 done 
#> lambda = 16.5835829145729 done 
#> lambda = 16.8348341708543 done 
#> lambda = 17.0860854271357 done 
#> lambda = 17.3373366834171 done 
#> lambda = 17.5885879396985 done 
#> lambda = 17.8398391959799 done 
#> lambda = 18.0910904522613 done 
#> lambda = 18.3423417085427 done 
#> lambda = 18.5935929648241 done 
#> lambda = 18.8448442211055 done 
#> lambda = 19.0960954773869 done 
#> lambda = 19.3473467336683 done 
#> lambda = 19.5985979899498 done 
#> lambda = 19.8498492462312 done 
#> lambda = 20.1011005025126 done 
#> lambda = 20.352351758794 done 
#> lambda = 20.6036030150754 done 
#> lambda = 20.8548542713568 done 
#> lambda = 21.1061055276382 done 
#> lambda = 21.3573567839196 done 
#> lambda = 21.608608040201 done 
#> lambda = 21.8598592964824 done 
#> lambda = 22.1111105527638 done 
#> lambda = 22.3623618090452 done 
#> lambda = 22.6136130653266 done 
#> lambda = 22.864864321608 done 
#> lambda = 23.1161155778894 done 
#> lambda = 23.3673668341709 done 
#> lambda = 23.6186180904523 done 
#> lambda = 23.8698693467337 done 
#> lambda = 24.1211206030151 done 
#> lambda = 24.3723718592965 done 
#> lambda = 24.6236231155779 done 
#> lambda = 24.8748743718593 done 
#> lambda = 25.1261256281407 done 
#> lambda = 25.3773768844221 done 
#> lambda = 25.6286281407035 done 
#> lambda = 25.8798793969849 done 
#> lambda = 26.1311306532663 done 
#> lambda = 26.3823819095477 done 
#> lambda = 26.6336331658291 done 
#> lambda = 26.8848844221106 done 
#> lambda = 27.136135678392 done 
#> lambda = 27.3873869346734 done 
#> lambda = 27.6386381909548 done 
#> lambda = 27.8898894472362 done 
#> lambda = 28.1411407035176 done 
#> lambda = 28.392391959799 done 
#> lambda = 28.6436432160804 done 
#> lambda = 28.8948944723618 done 
#> lambda = 29.1461457286432 done 
#> lambda = 29.3973969849246 done 
#> lambda = 29.648648241206 done 
#> lambda = 29.8998994974874 done 
#> lambda = 30.1511507537688 done 
#> lambda = 30.4024020100503 done 
#> lambda = 30.6536532663317 done 
#> lambda = 30.9049045226131 done 
#> lambda = 31.1561557788945 done 
#> lambda = 31.4074070351759 done 
#> lambda = 31.6586582914573 done 
#> lambda = 31.9099095477387 done 
#> lambda = 32.1611608040201 done 
#> lambda = 32.4124120603015 done 
#> lambda = 32.6636633165829 done 
#> lambda = 32.9149145728643 done 
#> lambda = 33.1661658291457 done 
#> lambda = 33.4174170854271 done 
#> lambda = 33.6686683417085 done 
#> lambda = 33.9199195979899 done 
#> lambda = 34.1711708542714 done 
#> lambda = 34.4224221105528 done 
#> lambda = 34.6736733668342 done 
#> lambda = 34.9249246231156 done 
#> lambda = 35.176175879397 done 
#> lambda = 35.4274271356784 done 
#> lambda = 35.6786783919598 done 
#> lambda = 35.9299296482412 done 
#> lambda = 36.1811809045226 done 
#> lambda = 36.432432160804 done 
#> lambda = 36.6836834170854 done 
#> lambda = 36.9349346733668 done 
#> lambda = 37.1861859296482 done 
#> lambda = 37.4374371859296 done 
#> lambda = 37.6886884422111 done 
#> lambda = 37.9399396984925 done 
#> lambda = 38.1911909547739 done 
#> lambda = 38.4424422110553 done 
#> lambda = 38.6936934673367 done 
#> lambda = 38.9449447236181 done 
#> lambda = 39.1961959798995 done 
#> lambda = 39.4474472361809 done 
#> lambda = 39.6986984924623 done 
#> lambda = 39.9499497487437 done 
#> lambda = 40.2012010050251 done 
#> lambda = 40.4524522613065 done 
#> lambda = 40.7037035175879 done 
#> lambda = 40.9549547738693 done 
#> lambda = 41.2062060301508 done 
#> lambda = 41.4574572864322 done 
#> lambda = 41.7087085427136 done 
#> lambda = 41.959959798995 done 
#> lambda = 42.2112110552764 done 
#> lambda = 42.4624623115578 done 
#> lambda = 42.7137135678392 done 
#> lambda = 42.9649648241206 done 
#> lambda = 43.216216080402 done 
#> lambda = 43.4674673366834 done 
#> lambda = 43.7187185929648 done 
#> lambda = 43.9699698492462 done 
#> lambda = 44.2212211055276 done 
#> lambda = 44.472472361809 done 
#> lambda = 44.7237236180905 done 
#> lambda = 44.9749748743719 done 
#> lambda = 45.2262261306533 done 
#> lambda = 45.4774773869347 done 
#> lambda = 45.7287286432161 done 
#> lambda = 45.9799798994975 done 
#> lambda = 46.2312311557789 done 
#> lambda = 46.4824824120603 done 
#> lambda = 46.7337336683417 done 
#> lambda = 46.9849849246231 done 
#> lambda = 47.2362361809045 done 
#> lambda = 47.4874874371859 done 
#> lambda = 47.7387386934673 done 
#> lambda = 47.9899899497487 done 
#> lambda = 48.2412412060301 done 
#> lambda = 48.4924924623116 done 
#> lambda = 48.743743718593 done 
#> lambda = 48.9949949748744 done 
#> lambda = 49.2462462311558 done 
#> lambda = 49.4974974874372 done 
#> lambda = 49.7487487437186 done 
#> lambda = 50 done