This function fits a brms model using the supplied database, formula and other function arguments tuning the model fitting process.
Arguments
- obj
A
HibDatabaseobject or a list of them.- form
A
formulain the style ofbrms(as inlme4) - including fixed and random effects.- family
A
familyfunction, e.g. gaussian, poisson - as allowed by brms- weight_specs
A named
listcontaining "weights" and "weight_type".weights: anumericvector containing the relative weights to assign to each dataset/site, should sum to 1.weight_type: acharacter, specifying either "dataset" or "site" - i.e. should the weights argument assign relative weights to whole datasets, or for sites in each dataset.
Only applicable if a list of
HibDatabases are provided.
The length of 'weights' should be equal to the number ofHibDatabases.
Note: if using this argument, the supplied formula should have a response of the formy | weights(data_weight) ~. The data_weight variable will be generated within the function call.- scale_specs
A named
listcontaining "covars_to_scale" and "scale_func".covars_to_scaleis acharactervector of numeric covariates that should be scaled prior to modelling.scale_funcis a function that will be used to scale the specified covariates - ifNULL,base::scale()will be used.
- relevel_specs
A
vectorwhere each item is:"<covar_to_relevel_name>" = "<base_level>".- ...
Any other named arguments that can be passed to
brms::brm(), e.g., prior, data2
Details
This function takes the supplied database object (and various other arguments), fits the specified model and returns a HibModelBRMS object.
References
Paul-Christian Bürkner (2017). brms: An R Package for Bayesian Multilevel Models Using Stan. Journal of Statistical Software, 80(1), 1-28. doi:10.18637/jss.v080.i01
Paul-Christian Bürkner (2018). Advanced Bayesian Multilevel Modeling with the R Package brms. The R Journal, 10(1), 395-411. doi:10.32614/RJ-2018-017
Paul-Christian Bürkner (2021). Bayesian Item Response Modeling in R with brms and Stan. Journal of Statistical Software, 100(5), 1-54. doi:10.18637/jss.v100.i05