Transforming a formula object into a list with the variables and their names for the beta regression model of the bayesbr package.
formula(formula, data = NULL)
symbolic description of the model (of type y ~ x
or y ~ x | z
;).
Data frame with regression observations
A list containing the following items:
A matrix containing the covariates for theta of the model,
A matrix containing the covariates of the model for zeta
The name passed in the call to the bayesbr
function for the variable response,
The name passed in the call to the bayesbr
function for the covariates for theta,
The name passed in the call to the bayesbr
function for covariates for zeta.
The form of the formula used for the Bayesbr
package follows the pattern proposed in Formula
. The expression y ~ represents that y is the response variable of the beta regression, everything to the right of the ~ operator represents covariates or intercepts for the parameter \(\theta\) or \(\zeta\) of the variable response .
The + operator adds one more explanatory covariate for the parameter,the operator : indicates interaction between variables adjacent to the operator,
operator * adds the variables adjacent to the operator as covariable and the interaction between them
the operator | represents that the next covariates are explanatory
for \(\zeta\) and those that were before the operator are explanatory
for \(\theta\). So, in the formula y ~ x1 + x2 | x3 + x4
x1 and x2
are the covariates for the parameter \(\theta\) and x3 and x4 are the
covariates of \(\zeta\). \(\theta\) and \(\zeta\) are parameters
of the variable y answer. The numbers 1 and 0 represent, respectively,
the presence or not of the intercept in the construction of the model.
By default, the intercept is included, so the number 1 is
necessary only when the user wants to include only the intercept for
the estimation of the parameter in question. Here are some examples:
y ~ 0 | x1
: No estimate for \(\theta\)
y ~ 1 | 0 + x2
: The estimation for \(\theta\) will be made only with the intercept, and the estimation for \(\zeta\) will not use the intercept only the covariable x2
y~ x3*x4 | x5:x6
: The estimation for \(\theta\) will be with the covariables x3
and x4
and the interaction between them, and the estimation for \(\zeta\) will be the interaction between variables x5
and x6
.
The variables passed to the formula can be environment variables or columns of a dataframe, in which case the dataframe must be informed.