runMCMCGlobal: Run MCMC estimation for hierarichal models with multiple...

Description Usage Arguments Value See Also Examples

View source: R/runmcmcglobal.R

Description

Run MCMC estimation of time series data for multiple countries using JAGS.

Usage

1
2
3
4
runMCMCGlobal(method, input.data, order = NULL, matern.cov = TRUE,
  cs.arma = NULL, cs.smoothing = TRUE, time.trend = FALSE,
  nserror.estimated = TRUE, nchains = 3, nburnin = 1000, niter = 2000,
  nthin = 1, model.file.path = NULL, model.save.file.path = "R/model.txt")

Arguments

method

The method of smoothing to implement (choices: ar, arma, splines, gp)

input.data

List of required input data. See processData, getSplinesData and getGPData to get required data in compatible form.

order

The order of splines penalization (either 1 or 2)

matern.cov

Whether or not to use Matern covariance function. Default is TRUE.

cs.arma

whether ARMA parameter(s) are country specific. If 'FALSE', parameter is global.

cs.smoothing

whether smoothing paramter is country specific. If 'FALSE', smoothing parameter is global.

time.trend

if 'TRUE' a linear time trend is estimated.

nserror.estimated

whether to estimate non-sampling error. IF 'FALSE', fixed sampling error is inputted.

nchains

Number of MCMC chains

nburnin

Number of iterations to throw away as burn in.

niter

Number of total iterations.

nthin

Degree of thinning of MCMC chains

model.file.path

Text file which contains the model to be fitted. If NULL, the text file is drawn from the models folder.

model.save.file.path

Path to save model, if written.

Value

A JAGS model object

See Also

processData, getSplinesData, getGPData

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
nyears <- 100
prop.sample <- 0.7
obs.err <- TRUE
sigma.y <- 0.5
seed <- 123
method <- 'splines'
params <- list(sigma.alpha = 1, order = 1)
df <- simulateFluctuations(nyears, prop.sample, method, params, obs.err, sigma.y)
df$se <- 1
mod <- runMCMC(input.data = df, nyears = 100, method = "splines", order = 1,
nchains = 4, nburnin = 100, niter = 100+3000, nthin = 3)

MJAlexander/distortr documentation built on July 17, 2020, 4:06 p.m.