Skip to contents

Given the model, the data and the formula for the model, this function will return the combined stan data generated by bmm and brms

Usage

# S3 method for class 'bmmformula'
standata(object, data, model, ...)

Arguments

object

A bmmformula object

data

An object of class data.frame, containing data of all variables used in the model. The names of the variables must match the variable names passed to the bmmodel object for required argurments.

model

A description of the model to be fitted. This is a call to a bmmodel such as mixture3p() function. Every model function has a number of required arguments which need to be specified within the function call. Call supported_models() to see the list of supported models and their required arguments

...

Further arguments passed to brms::standata(). See the description of brms::standata() for more details

Value

A named list of objects containing the required data to fit a bmm model with Stan.

Examples

sdata1 <- standata(bmf(c ~ 1, kappa ~ 1),
  data = oberauer_lin_2017,
  model = sdm(resp_error = "dev_rad")
)
str(sdata1)
#> List of 12
#>  $ N         : int 15200
#>  $ Y         : num [1:15200(1d)] 0.384 -0.4538 -0.0873 0.3665 -0.0349 ...
#>  $ K         : int 1
#>  $ Kc        : num 0
#>  $ X         : num [1:15200, 1] 1 1 1 1 1 1 1 1 1 1 ...
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$ : chr [1:15200] "1" "2" "3" "4" ...
#>   .. ..$ : chr "Intercept"
#>   ..- attr(*, "assign")= int 0
#>  $ K_c       : int 1
#>  $ Kc_c      : num 0
#>  $ X_c       : num [1:15200, 1] 1 1 1 1 1 1 1 1 1 1 ...
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$ : chr [1:15200] "1" "2" "3" "4" ...
#>   .. ..$ : chr "Intercept"
#>   ..- attr(*, "assign")= int 0
#>  $ K_kappa   : int 1
#>  $ Kc_kappa  : num 0
#>  $ X_kappa   : num [1:15200, 1] 1 1 1 1 1 1 1 1 1 1 ...
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$ : chr [1:15200] "1" "2" "3" "4" ...
#>   .. ..$ : chr "Intercept"
#>   ..- attr(*, "assign")= int 0
#>  $ prior_only: int 0
#>  - attr(*, "class")= chr [1:2] "standata" "list"