Extracts the priors used in the dynamite model as a data frame. You
can then alter the priors by changing the contents of the prior column and
supplying this data frame to dynamite function using the argument
priors. See vignettes for details.
Usage
get_priors(x, ...)
# S3 method for class 'dynamiteformula'
get_priors(x, data, time, group = NULL, ...)
# S3 method for class 'dynamitefit'
get_priors(x, ...)Arguments
- x
[
dynamiteformulaordynamitefit]
The model formula or an existingdynamitefitobject. Seedynamiteformula()anddynamite().- ...
Ignored.
- data
[
data.frame,tibble::tibble, ordata.table::data.table]
The data that contains the variables in the model in long format. Supported column types areinteger,logical,double, andfactor. Columns of typecharacterwill be converted to factors. Unused factor levels will be dropped. Thedatacan contain missing values which will simply be ignored in the estimation in a case-wise fashion (per time-point and per channel). Inputdatais converted to channel specific matrix representations viastats::model.matrix.lm().- time
[
character(1)]
A column name ofdatathat denotes the time index of observations. If this variable is a factor, the integer representation of its levels are used internally for defining the time indexing.- group
[
character(1)]
A column name ofdatathat denotes the unique groups orNULLcorresponding to a scenario without any groups. IfgroupisNULL, a new column.groupis created with constant value1Lis created indicating that all observations belong to the same group. In case of name conflicts withdata, see thegroup_varelement of the return object to get the column name of the new variable.
Note
Only the prior column of the output should be altered when defining
the user-defined priors for dynamite.
See also
Model fitting
dynamice(),
dynamite(),
update.dynamitefit()
Examples
data.table::setDTthreads(1) # For CRAN
d <- data.frame(y = rnorm(10), x = 1:10, time = 1:10, id = 1)
get_priors(obs(y ~ x, family = "gaussian"),
data = d, time = "time", group = "id"
)
#> CmdStan path has not been set yet. See ?set_cmdstan_path.
#> ℹ Switching to rstan backend.
#> parameter response prior type category
#> 1 alpha_y y normal(-0.48, 2) alpha
#> 2 beta_y_x y normal(0, 0.66) beta
#> 3 sigma_y y exponential(1) sigma
