-
Notifications
You must be signed in to change notification settings - Fork 0
/
brmsfit-class.Rmd
82 lines (74 loc) · 5.42 KB
/
brmsfit-class.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
title: "``brms::brmsfit-class``"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(brms)
```
brmsfit-class Class brmsfit of models fitted with the brms package
#### Description
Models fitted with the brms package are represented as a brmsfit object, which contains the posterior
samples, model formula, Stan code, relevant data, and other information.
#### Details
See methods(class = "brmsfit") for an overview of available methods.
Slots
* formula A brmsformula object
* family A brmsfamily object
* data A data.frame containing all variables used in the model
* data.name The name of data as specified by the user
* model The model code in Stan language
* prior A brmsprior object containing information on the priors used in the model
* autocor An cor_brms object containing the autocorrelation structure if specified
* ranef A data.frame containing the group-level structure
* cov_ranef A list of customized group-level covariance matrices
* stanvars A stanvars object or NULL
* stan_funs A character string of length one or NULL
* loo An empty slot for adding the loo information criterion after model fitting
* waic An empty slot for adding the waic information criterion after model fitting
* R2 An empty slot for adding the bayes_R2 (Bayesian R-squared) #### Value after model fitting
* marglik An empty slot for adding a bridge object after model fitting containing the log marginal
likelihood (see bridge_sampler for #### Details)
* fit An object of class stanfit among others containing the posterior samples
exclude The names of the parameters for which samples are not saved
* algorithm The name of the algorithm used to fit the model
version The versions of brms and rstan with which the model was fitted
file Optional name of a file in which the model object was stored in or loaded from
See Also
brms, brm, brmsformula, brmsfamily
#### Details
Family gaussian with identity link leads to linear regression. Family student with identity
link leads to robust linear regression that is less influenced by outliers. Family skew_normal can
handle skewed responses in linear regression. Families poisson, negbinomial, and geometric
with log link lead to regression models for count data. Families binomial and bernoulli with
logit link leads to logistic regression and family categorical to multi-logistic regression when
there are more than two possible outcomes. Families cumulative, cratio (’continuation ratio’),
sratio (’stopping ratio’), and acat (’adjacent category’) leads to ordinal regression. Families
Gamma, weibull, exponential, lognormal, frechet, and inverse.gaussian can be used (among
others) for survival regression. Families weibull, frechet, and gen_extreme_#### Value (’generalized
extreme #### Value’) allow for modeling extremes. Family asym_laplace allows for quantile regression
when fixing the auxiliary quantile parameter to the quantile of interest. Family exgaussian
(’exponentially modified Gaussian’) and shifted_lognormal are especially suited to model reaction
times. The wiener family provides an implementation of the Wiener diffusion model.
For this family, the main formula predicts the drift parameter ’delta’ and all other parameters
are modeled as auxiliary parameters (see brmsformula for #### Details). Families hurdle_poisson,
hurdle_negbinomial, hurdle_gamma, hurdle_lognormal, zero_inflated_poisson, zero_inflated_negbinomial,
zero_inflated_binomial, zero_inflated_beta, and zero_one_inflated_beta allow to estimate
zero-inflated and hurdle models. These models can be very helpful when there are many zeros
in the data (or ones in case of one-inflated models) that cannot be explained by the primary distribution
of the response. Families hurdle_lognormal and hurdle_gamma are especially useful, as
traditional lognormal or Gamma models cannot be reasonably fitted for data containing zeros in the
response.
In the following, we list all possible links for each family. The families gaussian, student,
skew_normal, exgaussian, asym_laplace, and gen_extreme_#### Value accept the links (as names)
identity, log, and inverse; families poisson, negbinomial, geometric, zero_inflated_poisson,
zero_inflated_negbinomial, hurdle_poisson, and hurdle_negbinomial the links log, identity, and sqrt; families binomial, bernoulli, Beta, zero_inflated_binomial, zero_inflated_beta,and zero_one_inflated_beta the links logit, probit, probit_approx, cloglog, cauchit, and
identity; families cumulative, cratio, sratio, and acat the links logit, probit, probit_approx,
cloglog, and cauchit; family categorical the link logit; families Gamma, weibull, exponential, frechet, and hurdle_gamma the links log, identity, and inverse; families lognormal and hurdle_lognormal the links identity and inverse; family inverse.gaussian the links 1/mu^2,
inverse, identity and log; family von_mises the link tan_half; family wiener the link identity.
The first link mentioned for each family is the default.
Please note that when calling the Gamma family function, the default link will be inverse not log.
Also, the probit_approx link cannot be used when calling the binomial family function.
The current implementation of inverse.gaussian models has some convergence problems and requires carefully chosen prior distributions to work efficiently. For this reason, we currently do not recommend to use the inverse.gaussian family, unless you really feel that your data requires exactly this type of model.
See Also
brm, family, customfamily