sample_new_nngps: Sample new nearest-neighbor Gaussian processes for doing...

Description Usage Arguments Details Value Examples

View source: R/wrappers.R

Description

Sample new nearest-neighbor Gaussian processes based on posterior MCMC samples.

Usage

1
sample_new_nngps(scc_scan_file, mcmc_fit_file, outpath, stationary_iterations, parallel = FALSE, ncores = 10, return = FALSE)

Arguments

scc_scan_file

Path to the rds file output by run_scc_scan

mcmc_fit_file

Path to the rds file output by fit_nngp

outpath

Path to where the output will be written. The output file should be given the .rds file extension.

stationary_iterations

Which MCMC iterations to use for posterior samples.

parallel

Logical. Should the MCMC fitting be parallelized

ncores

If parallel = TRUE, number of cores to parallelize over.

BOOT

Number of bootstrap replicates to do.

nbatches

Numeric. Number of batches to use. This option will split the bootstrapping into batches to save memory but increase computation time.

return

Logical. Should the output also be returned by the function?

Details

This function samples new NNGPs based on the posterior MCMC samples, which are ultimately used for hypothesis testing. MCMC chains need some time to reach convergence, and posterior samples can produce quite large files. For that reason, it is suggested not to use all MCMC iterations as the stationary_iterations. For example, from an MCMC with 15,000 iterations, one could set stationary_iterations=5001:15000

Value

If return = TRUE, this function outputs a list of nearest-neighbor Gaussian processes generated based on on posterior MCMC samples.

Examples

1
2
# Use posterior samples to make new draws from the nearest-neighbor Gaussian process, for hypothesis testing
sample_new_nngps(scc_scan_file = "inst/extdata/output/z.rds", mcmc_fit_file = "inst/extdata/output/fit.rds", outpath = "inst/extdata/output/pred.rds", stationary_iterations = 101:150, parallel = FALSE, BOOT = 100, nbatches = 1)

hillarykoch/locdiffr documentation built on April 25, 2021, 6:26 p.m.