Returns the input data to the Stan model. Mostly useful for debugging.
Usage
get_data(x, ...)
# S3 method for class 'dynamiteformula'
get_data(x, data, time, group = NULL, ...)
# S3 method for class 'dynamitefit'
get_data(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.
See also
Model outputs
as.data.frame.dynamitefit(),
as.data.table.dynamitefit(),
as_draws_df.dynamitefit(),
coef.dynamitefit(),
confint.dynamitefit(),
dynamite(),
get_code(),
get_parameter_dims(),
get_parameter_names(),
get_parameter_types(),
ndraws.dynamitefit(),
nobs.dynamitefit()
Examples
data.table::setDTthreads(1) # For CRAN
d <- data.frame(y = rnorm(10), x = 1:10, time = 1:10, id = 1)
str(get_data(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.
#> List of 24
#> $ K_fixed_y : int 1
#> $ K_varying_y : int 0
#> $ K_random_y : int 0
#> $ K_y : int 1
#> $ J_fixed_y : int [1(1d)] 1
#> ..- attr(*, "dimnames")=List of 1
#> .. ..$ : chr "x"
#> $ J_varying_y : int[0 (1d)]
#> $ J_y : int [1(1d)] 1
#> ..- attr(*, "dimnames")=List of 1
#> .. ..$ : chr "x"
#> $ J_random_y : int[0 (1d)]
#> $ L_fixed_y : int [1(1d)] 1
#> $ L_varying_y : int[0 (1d)]
#> $ obs_y : int [1, 1:10] 1 1 1 1 1 1 1 1 1 1
#> $ n_obs_y : int [1:10] 1 1 1 1 1 1 1 1 1 1
#> $ t_obs_y : int [1:10(1d)] 1 2 3 4 5 6 7 8 9 10
#> $ T_obs_y : int 10
#> $ y_y : num [1, 1:10] -2.2147 1.1249 -0.0449 -0.0162 0.9438 ...
#> $ beta_prior_pars_y: num [1, 1:2] 0 0.66
#> $ N : int 1
#> $ K : int 1
#> $ X : num [1:10, 1, 1] 1 2 3 4 5 6 7 8 9 10
#> $ M : int 0
#> $ P : num 0
#> $ T : int 10
#> $ X_m : num [1(1d)] 1
#> $ grainsize : num 10
