Description Usage Arguments Details Value Examples
Estimates the precision matrix from the basis graphical lasso model.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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. |
lambda |
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 |
basis |
Character string for type of basis desired, currently only supports LatticeKrig-type basis. |
Phi |
Basis matrix, if not specified in |
guess |
An initial guess at the precision matrix. Default: identity matrix. |
outer_tol |
Tolerance. Default: see |
MAX_ITER |
Maximum number of iterations. Default: see |
MAX_RUNTIME_SECONDS |
Maximum runtime in seconds. Default: see |
tau_sq |
Nugget variance, estimated by |
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. |
... |
Other options relevant for basis specification such as NC and nlevel for LatticeKrig-type bases. |
This takes the data itself as input, along with choices or inputs for basis function and nugget variance, and appropriately sends it to the main algorithm in the paper.
Precision matrix of the random coefficients in the weighted sum of basis functions, and estimated (or provided) nugget variance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | precision.fit <- BGL(y=tmin$data, locs=tmin$lon.lat.proj, lambda=7, basis="LatticeKrig",
distance.penalty=TRUE,outer_tol=5e-2, MAX_ITER=50,
MAX_RUNTIME_SECONDS=86400, NC=20, nlevel=1)
# The estimate in paper, with the tolerance set to 1e-2 not 5e-2 and NC=30 not NC=20.
# Takes a few minutes longer than the version above
# precision.fit <- BGL(y=tmin$data, locs=tmin$lon.lat.proj, lambda=7, basis="LatticeKrig",
# distance.penalty=TRUE,outer_tol=1e-2, MAX_ITER=50,
# MAX_RUNTIME_SECONDS=86400, NC=30, nlevel=1)
# Plot standard errors
cholQ <- chol(precision.fit$Q)
Phi <- precision.fit$Phi
marginal_variances <- rep(NA,dim(Phi)[1])
for(i in 1:dim(Phi)[1])
{
marginal_variances[i] <- norm(backsolve(cholQ,Phi[i,],transpose=TRUE) ,type="F")^2
}
quilt.plot(tmin$lon.lat.proj,sqrt(marginal_variances),
main="Estimated process standard deviation")
# A (noisy) simulation
c_coef <- backsolve(cholQ,rnorm(dim(Phi)[2]))
sim <- Phi %*% c_coef + sqrt(precision.fit$nugget_variance)*rnorm(dim(Phi)[1])
quilt.plot(tmin$lon.lat.proj,sim,main="Simulation")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.