Package 'spherDir'

Title: Spherical Dirichlet Distribution
Description: Maximum likelihood estimation, regression analysis, random values generation, and other functions for the spherical Dirichlet distribution. The relevant paper is Harris and Guardiola (2026) <doi:10.1080/03610926.2026.2722098>.
Authors: Michail Tsagris [aut, cre]
Maintainer: Michail Tsagris <[email protected]>
License: GPL (>= 2)
Version: 1.0
Built: 2026-11-22 01:14:12 UTC
Source: https://github.com/cran/spherDir

Help Index


Spherical Dirichlet Distribution

Description

Maximum likelihood estimation, regression analysis, random values generation, and other functions for the spherical Dirichlet distribution.

Details

Package: spherDir
Type: Package
Version: 1.0
Date: 2026-11-02

Maintainers

Michail Tsagris <[email protected]>.

Author(s)

Michail Tsagris [email protected]

References

Harris J. and Guardiola J. (2026). Inferential methods for the spherical-Dirichlet distribution. Communications in Statistics-Theory and Methods, 55(23): 8245–8269.


Density values of the zero adjusted Dirichlet distribution

Description

Density values of the zero adjusted Dirichlet distribution.

Usage

dsdd(y, a, logged = FALSE)

Arguments

y

A matrix with compositional data with zero values.

a

The parameters of the spherical Dirichlet distribution.

logged

A boolean variable specifying whether the logarithm of the density values to be returned. It is set to TRUE by default.

Details

The density values of the zero adjusted Dirichlet distribution are computed.

Value

A vector with the density values.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris [email protected].

References

Harris J. and Guardiola J. (2026). Inferential methods for the spherical-Dirichlet distribution. Communications in Statistics-Theory and Methods, 55(23): 8245–8269.

See Also

sdd.mle, sdd.reg

Examples

y <- as.matrix(iris[, 1:3])
y <- y / rowSums(y)
y <- sqrt(y)
mod <- sdd.mle(y)
den <- dsdd(y, mod$a)

MLE of the spherical Dirichlet distribution

Description

MLE of the spherical Dirichlet distribution.

Usage

sdd.mle(y, tol = 1e-7)

Arguments

y

A matrix with the compositional data.

tol

The tolerance value to terminate the Newton-Raphson algorithm.

Details

A spherical Dirichlet distribution is being fitted and its parameters are estimated.

Value

A list including:

loglik

The value of the log-likelihood.

a

The parameters of the distribution.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris [email protected].

References

Harris J. and Guardiola J. (2026). Inferential methods for the spherical-Dirichlet distribution. Communications in Statistics-Theory and Methods, 55(23): 8245–8269.

See Also

sdd.reg

Examples

y <- as.matrix(iris[, 1:3])
y <- y / rowSums(y)
y <- sqrt(y)
mod <- sdd.mle(y)

Random values simulation from the spherical Dirichlet distribution

Description

Random values simulation from the spherical Dirichlet distribution.

Usage

rsdd(n, a)

Arguments

n

The number of compositional vectors to simulate.

a

The parameters of the spherical Dirichlet distribution.

Details

Random values from the spherical Dirichlet distribution are generated.

Value

A matrix with values generated from the spherical Dirichlet distribution.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris [email protected].

References

Harris J. and Guardiola J. (2026). Inferential methods for the spherical-Dirichlet distribution. Communications in Statistics-Theory and Methods, 55(23): 8245–8269.

See Also

sdd.mle, sdd.reg

Examples

y <- as.matrix(iris[, 1:3])
y <- y / rowSums(y)
y <- sqrt(y)
mod <- sdd.mle(y)
x <- rsdd(100, mod$a)

Spherical Dirichlet regression

Description

Spherical Dirichlet regression.

Usage

sdd.reg(y, x, xnew = NULL, tol = 1e-6, maxit = 100)

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.

xnew

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

tol

The tolerance value to terminate the Newton-Raphson algorithm.

maxit

The maximum number of iterations allowed in the Newton-Raphson algortihm.

Details

A spherical Dirichlet regression is being fitted.

Value

A list including:

runtime

The time required by the regression.

loglik

The value of the log-likelihood.

iters

The iterations required by the IRLS algorithm.

phi

The precision parameter, ϕ\phi.

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 and Christos Adam.

R implementation and documentation: Michail Tsagris [email protected].

References

Harris J. and Guardiola J. (2026). Inferential methods for the spherical-Dirichlet distribution. Communications in Statistics-Theory and Methods, 55(23): 8245–8269.

See Also

sdd.mle

Examples

x <- as.vector(iris[, 4])
y <- as.matrix(iris[, 1:3])
y <- y / rowSums(y)
y <- sqrt(y)
mod <- sdd.mle(y)
mod1 <- sdd.reg(y, x)