fit_cont_pars: Sets up MCMC to fit the parameters of the contour Model in R,...

Description Usage Arguments Value Examples

Description

Sets up MCMC to fit the parameters of the contour Model in R, then runs the sampler in C++

Usage

1
2
3
4
5
6
fit_cont_pars(r, n_iter, y_obs, reg_info, dists = NULL,
  sigma_min = 0.01, sigma0_lb = NULL, sigma0_ub = NULL,
  xU_prop_sd_def = 0.03, mu_ini = NULL, mu0 = NULL, lambda0 = NULL,
  sigma_ini = NULL, sigma_prop_cov = NULL, sigma_sp = 25,
  rho_ini = 0.5, rho0_lb = 0, rho0_ub = 0.99, rho_prop_sd = 0.01,
  w = 20)

Arguments

r

number indicating which region in the reg_info list is being considered

n_iter

number of iterations to run the MCMC, must be a multiple of w

y_obs

output of y_obs function. This is a list of matrices, one per region, giving the observed y values. Each row corresponds to the lines and each column corresponds to a training year

reg_info

a reg_info list (see documentation for reg_info)

dists

symmetric matrix of the same dimension as the number of lines being used, specifying distances among indices. Defaults to NULL, which means atrix will be computed by the dist_mat function

sigma_min

minimum value for all σ parameters. Typically close to but not exactly zero (defaults to 0.01). Not used if sigma0_lb is set to NULL

sigma0_lb

vector of the same length as the number of lines which specifies the lower bound of the uniform prior for each sigma value. Defaults to NULL, meaning sigma0_lb is set to be a vector with all values set to sigmaMin

sigma0_ub

vector of the same length as the number of lines which specifies the upper bound of the uniform prior for each sigma value. Defaults to NULL

xU_prop_sd_def

Standard deviation for proposals for xU when xU can take on an infinite set of values

mu_ini

vector of the same length as the number of lines which specifies the values from which each element of μ will be initialized in the MCMC. Defaults to NULL, meaning μ will be initialized with the mean of the observed y's

mu0

vector of the same length as the number of lines which specifies the prior mean for μ. Defaults to NULL, meaning each element in mu0 will be set to be in the middle of its corresponding line

lambda0

matrix of the same dimension as the number of lines which specifices the prior covariance matrix for μ. Defaults to NULL, which gives a diagonal matrix with diagonal elements corresponding to the variance that would be required for 80 values of the corresponding line if the data were normally distributed.

sigma_ini

vector of the same length as the number of lines which specifies the values from which each element in Σ will be initialized from. Defaults to NULL, meaning each element of Σ will be initialized with the observed standard deviation of its corresponding y's, bounded by sigma0_lb and sigma0_ub.

sigma_prop_cov

covariance matrix of the same length as the number of lines that is used in sampling Σ values. Defaults to NULL, meaning a diagonal matrix is used. The elements on the diagonal of this matrix are generally set to have value sigma_ini/20 unless the corresponding observed y's have zero variance, in which case these values are set to 0.1.

sigma_sp

integer specifying how many elements in the Σ matrix should be sampled together in the MCMC. Defaults to 25.

rho_ini

double between 0 and 1 from which the value of rho will be initialized. Defaults to 0.5

rho0_lb

double between 0 and 1 which gives the lower bound of the uniform prior for rho. Detauls to 0.

rho0_ub

double between 0 and 1 which gives the upper bound of the uniform prior for rho. Defaults to 1.

rho_prop_sd

standard deviation for the normal proposal distribution used when proposing value for rho in the sampler. Defaults to 0.01

w

integer specifying how many samples of the parameters will be maintained. Samples from every w-th iteration is stored.

Value

List that gives the values of the MCMC chain for xU, mu, sigma and rho along with indicators of acceptance on each iteration: xURate, sigmaRate, and rhoRate. Background information is also outputted including the upper and lower bounds for unobserved x's (xU_lb, xU_ub), vectors giving the first and last indices of each grouping in sampling Σ (sigma_ind_1,sigma_ind_2), the distance matrix (dists), and the integer specifying how many samples of the parameters will be maintained w

Examples

1
2
3
4
5
## Not run: 
y_obs <- y_obs(maps = obs_maps, reg_info)
res <- fit_cont_pars(r = 3, n_iter = 1000, y_obs, reg_info)

## End(Not run)

IceCast documentation built on June 24, 2019, 9:03 a.m.