Sets up MCMC to fit the parameters of the contour Model in R, then runs the sampler in C++
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)
number indicating which region in the reg_info
list is being
considered
number of iterations to run the MCMC, must be a multiple of w
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
a reg_info
list (see documentation for reg_info
)
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
minimum value for all \(\sigma\) parameters.
Typically close to but not exactly zero (defaults to 0.01).
Not used if sigma0_lb
is set to NULL
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
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
Standard deviation for proposals for xU when xU can take on an infinite set of values
vector of the same length as the number of lines which
specifies the values from which each element of \(\mu\) will
be initialized in the MCMC. Defaults to NULL
, meaning
\(\mu\) will be initialized with the mean of the observed y's
vector of the same length as the number of lines which specifies
the prior mean for \(\mu\). Defaults to NULL
, meaning
each element in mu0
will be set to be in the middle of its
corresponding line
matrix of the same dimension as the number of lines which
specifices the prior covariance matrix for \(\mu\). 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.
vector of the same length as the number of lines which
specifies the values from which each element in \(\Sigma\)
will be initialized from. Defaults to NULL
, meaning
each element of \(\Sigma\) will be initialized with
the observed standard deviation of its corresponding y's,
bounded by sigma0_lb
and sigma0_ub
.
covariance matrix of the same length as the number of
lines that is used in sampling \(\Sigma\) 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.
integer specifying how many elements in the \(\Sigma\) matrix should be sampled together in the MCMC. Defaults to 25.
double between 0 and 1 from which the value of rho
will
be initialized. Defaults to 0.5
double between 0 and 1 which gives the lower bound of the
uniform prior for rho
. Detauls to 0.
double between 0 and 1 which gives the upper bound of the
uniform prior for rho
. Defaults to 1.
standard deviation for the normal proposal distribution used
when proposing value for rho
in the sampler. Defaults
to 0.01
integer specifying how many samples of the parameters will be maintained. Samples from every w-th iteration is stored.
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\)
(sigma_ind_1
,sigma_ind_2
), the distance matrix
(dists
), and the integer specifying how many samples of the
parameters will be maintained w
# NOT RUN {
y_obs <- y_obs(maps = obs_maps, reg_info)
res <- fit_cont_pars(r = 3, n_iter = 1000, y_obs, reg_info)
# }
Run the code above in your browser using DataLab