zadr: Zero adjusted Dirichlet regression

View source: R/zadr.R

Zero adjusted Dirichlet regressionR Documentation

Zero adjusted Dirichlet regression

Description

Zero adjusted Dirichlet regression.

Usage

zadr(y, x, con = TRUE, B = 1, ncores = 2, xnew = NULL)
zadr2(y, x, con = TRUE, B = 1, ncores = 2, xnew = NULL)

Arguments

y

A matrix with the compositional data (dependent variable). The number of observations (vectors) with no zero values should be more than the columns of the predictor variables. Otherwise, the initial values will not be calculated.

x

The predictor variable(s), they can be either continnuous or categorical or both.

con

If this is TRUE (default) then the constant term is estimated, otherwise the model includes no constant term.

B

If B is greater than 1 bootstrap estimates of the standard error are returned. If you set this greater than 1, then you must define the number of clusters in order to run in parallel.

ncores

The number of cores to use when B>1. This is to be used for the case of bootstrap. If B = 1, this is not taken into consideration. If this does not work then you might need to load the doParallel yourselves.

xnew

If you have new data use it, otherwise leave it NULL.

Details

A zero adjusted Dirichlet regression is being fittd. The likelihood conists of two components. The contributions of the non zero compositional values and the contributions of the compositional vectors with at least one zero value. The second component may have many different sub-categories, one for each pattern of zeros. The function "zadr2()" links the covariates to the alpha parameters of the Dirichlet distribution, i.e. it uses the classical parametrization of the distribution. This means, that there is a set of regression parameters for each component.

Value

A list including:

runtime

The time required by the regression.

loglik

The value of the log-likelihood.

phi

The precision parameter.

be

The beta coefficients.

seb

The standard error of the beta coefficients.

sigma

Th covariance matrix of the regression parameters (for the mean vector and the phi parameter).

est

The fitted or the predicted values (if xnew is not NULL).

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

References

Tsagris M. and Stewart C. (2018). A Dirichlet regression model for compositional data with zeros. Lobachevskii Journal of Mathematics,39(3): 398–412.

Preprint available from https://arxiv.org/pdf/1410.5011.pdf

See Also

zad.est, diri.reg, kl.compreg, ols.compreg, alfa.reg

Examples

x <- as.vector(iris[, 4])
y <- as.matrix(iris[, 1:3])
y <- y / rowSums(y)
mod1 <- diri.reg(y, x)
y[sample(1:450, 15) ] <- 0
mod2 <- zadr(y, x)

Compositional documentation built on Oct. 9, 2024, 5:10 p.m.