prep_init_list: Prepare the list of values for initializing the Stan model

Description Usage Arguments Details Value See Also Examples

View source: R/prep_init_list.R

Description

Generates a list, of length chains, where each element of the list is a named list giving the initialization values for each model parameter. Initialization values are randomly drawn from the prior distribution, and are drawn independently for each chain.

Usage

1
2
prep_init_list(prior_file, tails = c("none", "left", "right", "mirror",
  "ind"), chains, type = c("pheno", "geno"))

Arguments

prior_file

Path to the .yaml file containing the prior specifications.

tails

Which type of tails for the model: "none", "left", "right", "mirror", or "ind"?

chains

The number of chains to be used in Stan. Integer.

type

Are the intial values for a phenotypic cline or genetic cline: "pheno", or "geno"? Only affects limit checking for the pmin and pmax initial values, which must be between 0 and 1 for genetic clines.

Details

Currently supported distributions are: normal, uniform, exponential.

This function calls init_single_chain for each chain. init_single_chain does all the work of making the expression which will yield the proper starting values for a chain of this model.

This function also provides checks that the specified starting values will work with Stan. If the priors are poorly specified such that some initial values are inappropriate (e.g., width initial values are negative), it will re-do the initialization, up to 100 times per chain. If, after 100 tries, it fails to generate an appropriate starting chain, it will generate a warning and provide some guidance on which parameters are causing the problem.

Value

A list of lists containing initialization values for the Stan model.

See Also

init_single_chain, fit_geno_cline

Examples

1
2
3
4
## Not run: 
prep_init_list("path/to/priors.yaml", tails = "none", chains = as.integer(3))

## End(Not run)

tjthurman/BAHZ documentation built on May 30, 2020, 8:28 a.m.