Learn R Programming

DirichletReg (version 0.3-0)

DirichReg: Fitting a Dirichlet Regression

Description

This function allows for fitting Dirichlet regression models using two different

Usage

DirichReg(formula, data, weights, control, verbosity = 0, ...)

Arguments

formula
model formula, for different specifications see details
data
data
weights
vector of weights
control
a list containing control parameter used for the optimization
verbosity
information about the function's progress
...
further arguments

Value

  • all the valuesdescription

Details

Formula Specification{ formula determines the used predictors and the parametrization that will be employed. The responses must be prepared by DR_data. There are two different parametrization: the common param. that models each alpha by an individual set of predictors and the alternative param. that models expected values (as in multinomial logistic regression) and precision parameters with two sets of predictors.
  • To set up a commonly parametrized model, typeDV ~ p1 + p2, whereDVis the dependent variable prepared byDR_dataandp1andp1are predictors. The employed predictors will be the same for every dependent variable. If you want to use a different set for the dependent variables you can separate the sets by|s like this:DV ~ p1 | p1 + p2 | p1 * p2. This means that the first response inDVwill be modeled usingp1, the second will be predicted byp1 + p2and so on. Note that if you use the latter approach, the predictors have to be stated explicitly for all response variables.
  • The alternative parametrization works consists of two parts: the expected values and theirprecision. As in multinomial logistic regression, one response variable is omitted (by default the first, but this can be changed by thebaseargument inDR_data) and for the rest a set of predictors is used with a logit-link. For precisions, a different set of predictors can be set up using a log-link.DV ~ p1 * p2 | phi ~ p1 + p2will set up a model where the expected values are predicted byp1 * p2and precision are modeled usingp1 + p2. Note that the second part of the formulamustbephi ~to set up the alterantive parametrization.
} Using the control argument, the settings passed to optim can be altered. To alter starting values for example the code would be control = list(sv=c(1,2,3, ...)) where c(1,2,3, ...) contains the appropriate starting values to be used.

Examples

Run this code
# fit a quadratic Dirichlet regression models
AL <- DR_data(ArcticLake[,1:3])

res1 <- DirichReg(AL ~ depth + I(depth^2), ArcticLake)
res2 <- DirichReg(AL ~ depth + I(depth^2) | phi ~ depth, ArcticLake)

res1
summary(res1)

anova(res1, res2)

Run the code above in your browser using DataLab