Learn R Programming

brms (version 1.1.0)

brmsfamily: Special Family Functions for brms Models

Description

Family objects provide a convenient way to specify the details of the models used by many model fitting functions. The familiy functions present here are currently for use with brms only and will NOT work with other model fitting functions such as glm or glmer. However, the standard family functions as decribed in family will work with brms.

Usage

brmsfamily(family, link = NULL)
student(link = "identity")
bernoulli(link = "logit")
negbinomial(link = "log")
geometric(link = "log")
lognormal(link = "identity")
exponential(link = "log")
weibull(link = "log")
Beta(link = "logit")
von_mises(link = "tan_half")
hurdle_poisson(link = "log")
hurdle_negbinomial(link = "log")
hurdle_gamma(link = "log")
zero_inflated_beta(link = "logit")
zero_inflated_poisson(link = "log")
zero_inflated_negbinomial(link = "log")
zero_inflated_binomial(link = "logit")
categorical(link = "logit")
cumulative(link = "logit")
sratio(link = "logit")
cratio(link = "logit")
acat(link = "logit")

Arguments

family
A character string naming the distribution of the response variable be used in the model. Currently, the following families are supported: gaussian, student, binomial, bernoulli, poisson, negbinomial, geometric, Gamma, lognormal, inverse.gaussian, exponential, weibull, Beta, von_mises, categorical, cumulative, cratio, sratio, acat, hurdle_poisson, hurdle_negbinomial, hurdle_gamma, zero_inflated_binomial, zero_inflated_beta, zero_inflated_negbinomial, and zero_inflated_poisson.
link
A specification for the model link function. This can be a name/expression or character string. See the 'Details' section for more information on link functions supported by each family.

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. 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 ('contiuation ratio'), sratio ('stopping ratio'), and acat ('adjacent category') leads to ordinal regression. Families Gamma, weibull, exponential, lognormal, and inverse.gaussian can be used (among others) for survival regression. Families hurdle_poisson, hurdle_negbinomial, hurdle_gamma, zero_inflated_poisson, and zero_inflated_negbinomial combined with the log link, and zero_inflated_binomial with the logit link, allow to estimate zero-inflated and hurdle models. These models can be very helpful when there are many zeros in the data that cannot be explained by the primary distribution of the response. Family hurdle_gamma is especially useful, as a traditional Gamma model 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, and student, accept the links (as names) identity, log, and inverse; families poisson, negbinomial, and geometric the links log, identity, and sqrt; families binomial, bernoulli, Beta, cumulative, cratio, sratio, and acat the links logit, probit, probit_approx, cloglog, and cauchit; family categorical the link logit; families Gamma, weibull, and exponential the links log, identity, and inverse; family lognormal the links identity and inverse; family inverse.gaussian the links 1/mu^2, inverse, identity and log; families hurdle_poisson, hurdle_negbinomial, hurdle_gamma, zero_inflated_poisson, and zero_inflated_negbinomial the link log. 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

Examples

Run this code
 # create a family object
 (fam1 <- student("log"))
 # alternatively use the brmsfamily function
 (fam2 <- brmsfamily("student", "log"))
 # both leads to the same object
 identical(fam1, fam2) 

Run the code above in your browser using DataLab