DirichReg(formula, data, weights, control, verbosity = 0, ...)
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 DV ~ p1 + p2
, whereDV
is the dependent variable prepared byDR_dataandp1
andp1
are 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 inDV
will be modeled usingp1
,
the second will be predicted byp1 + p2
and so on.
Note that if you use the latter approach, the predictors have to be stated
explicitly for all response variables.base
argument 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 + p2
will set up a model where the expected
values are predicted byp1 * p2
and precision are modeled usingp1 + p2
. Note that the second part of the formulamustbephi ~
to set up the alterantive parametrization.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.# 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