est_sbetel: Estimate a smoothed BETEL model

Description Usage Arguments Details Value Examples

View source: R/core.R

Description

Estimate a smoothed BETEL model by generating a sample from the parameter posterior density with a RWMH algorithm. Subchains are used for integrating over the stochastic prior defined by the prior data generating process prior_fun().

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
est_sbetel(
  model,
  chain_length = 100,
  chain_number = 1,
  tune,
  type = c("posterior", "likelihood", "prior")[1],
  burn = 50,
  parallel = 1,
  itermax = 20,
  backup = NULL,
  verbose = TRUE
)

Arguments

model

A list returned by init_sbetel() defining the model.

chain_length

The length of one subchain.

chain_number

The number of subchains. The total (not independent) size of the sample equals chain_length x chain_number.

tune

A parameter that controls the step size of the RWMH algorithm. Should be chosen to accomplish an acceptance rate of approximately 20-25 sbetel:::auto_tune(model, type = "posterior") might be of help.

type

Should be either "posterior", "likelihood" or "prior". Defaults to "posterior".

burn

The length of the burn-in period. Should be enough for correlation of the subchain from its initial value to vanish.

parallel

Specifies the number of logical processors used for parallel processing of the subchains. Defaults to 1 in which case no parallel processing is used. parallel::detectCores() can be used to find out the number of logical processors on your machine.

itermax

Maximum number of Newton-Rhapson iterations within the evaluation of the likelihood. Defaults to 20 which should be more than enough.

backup

NULL or a character string that names the directory in which the backups of the subchains are saved as they are completed. Defaults to NULL in which case no backups are created.

verbose

Logical. Defaults to TRUE in which case messages are produced.

Details

TBA

Value

est_sbetel() returns a list containing the output of the RWMH algorithm.

Examples

1
2
3
4
## Not run: 
output <- est_sbetel(model, tune = 0.1)

## End(Not run)

jetroant/sbetel documentation built on Oct. 20, 2020, 1:11 a.m.