BGL_CV: Basis Graphical Lasso Cross Validation

Description Usage Arguments Details Value Examples

View source: R/BGL_CV.R

Description

Estimates the precision matrix from basis graphical lasso model

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
BGL_CV(
  kfolds = 5,
  y,
  locs,
  lambdalist,
  zero.diagonal.penalty = TRUE,
  basis = "LatticeKrig",
  Phi = NULL,
  guess = NULL,
  outer_tol = NULL,
  MAX_ITER = NULL,
  MAX_RUNTIME_SECONDS = NULL,
  tau_sq = NULL,
  verbose = TRUE,
  distance.penalty = FALSE,
  final.guess = TRUE,
  ...
)

Arguments

kfolds

Number of cross validation folds.

y

Real-valued data matrix of dimension (number of spatial locations) x (number of realizations).

locs

Matrix of real-valued spatial locations of data of dimension (number of spatial locations) x 2.

lambdalist

Penalty parameter. Can be either a nonnegative real, or a matrix of nonnegative reals whose dimension is the same as the number of graph nodes.

zero.diagonal.penalty

Boolean, if TRUE with a scalar penalty lambda, then diagonals of the precision matrix are not penalized. Default: TRUE.

basis

Character string for type of basis desired, currently only supports LatticeKrig-type basis.

Phi

Basis matrix, if not specified in basis option. Rows index location and columns index basis function, Default: NULL.

guess

An initial guess at the precision matrix. Default of guess if not specified is the identity matrix.

outer_tol

Tolerance. Default: see BGL_DC.

MAX_ITER

Maximum number of iterations. Default: see BGL_DC.

MAX_RUNTIME_SECONDS

Maximum runtime in seconds. Default: see BGL_DC.

tau_sq

Nugget variance, estimated by nugget_estimate if not provided.

verbose

Print algorithm details after each iteration. Default: TRUE.

distance.penalty

If using LatticeKrig Wendland basis functions and a constant lambda, then multiply the distance matrix of the basis centers times lambda for the penalty matrix, Default: FALSE.

final.guess

Return the final estimate with the best penalty parameter, Default: TRUE.

...

Other options relevant for basis specification such as NC and nlevel for LatticeKrig-type bases.

Details

This is the algorithm suggested in the paper. It uses the QUIC algorithm to solve the penalized likelihood problem for each fold, training the model based on "training data" and evaluating fit based on the likelihood with the "testing data". Note that in the paper, the value λ=7 is reported, which should be consistent with R < version 3.6. With the most recent R version 4.0, the seed is different and λ=8 is selected.

Value

Precision matrix of the random coefficients in the weighted sum of basis functions.

Examples

1
2
3
#the full search space considered, commented for runtime, will take very long
#CVguess <- BGL_CV(kfolds=2, y=tmin$data, locs=tmin$lon.lat.proj, lambdalist=1:30, basis="LatticeKrig",
    #outer_tol=0.05, MAX_ITER=50, MAX_RUNTIME_SECONDS=86400, NC=30, nlevel=1,distance.penalty=TRUE)

mlkrock/BasisGraphicalLasso documentation built on Dec. 21, 2021, 7:59 p.m.