View source: R/simulation_functions.R
fast_Gp_sim_Linv | R Documentation |
In situations where we want to do many gaussian process
simulations from the same model, we can compute Linverse
once and reuse it, rather than recomputing for each identical simulation.
This function also allows the user to input the vector of standard normals z
.
fast_Gp_sim_Linv(Linv, NNarray, z = NULL)
Linv |
Matrix containing the entries of Linverse, usually the output from
|
NNarray |
Matrix of nearest neighbor indices, usually the output from |
z |
Optional vector of standard normals. If not specified, these are computed within the function. |
vector of simulated values
locs <- as.matrix( expand.grid( (1:50)/50, (1:50)/50 ) )
ord <- order_maxmin(locs)
locsord <- locs[ord,]
m <- 10
NNarray <- find_ordered_nn(locsord,m)
covparms <- c(2, 0.2, 1, 0)
Linv <- vecchia_Linv( covparms, "matern_isotropic", locsord, NNarray )
y <- fast_Gp_sim_Linv(Linv,NNarray)
y[ord] <- y
fields::image.plot( matrix(y,50,50) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.