kl.alfapcr: Divergence based regression for compositional data with...

View source: R/kl.alfapcr.R

Divergence based regression for compositional data with compositional data in the covariates side using the alpha-transformationR Documentation

Divergence based regression for compositional data with compositional data in the covariates side using the \alpha-transformation

Description

Divergence based regression for compositional data with compositional data in the covariates side using the \alpha-transformation.

Usage

kl.alfapcr(y, x, covar = NULL, a, k, xnew = NULL, B = 1, ncores = 1, tol = 1e-07,
maxiters = 50)

Arguments

y

A numerical matrixc with compositional data with or without zeros.

x

A matrix with the predictor variables, the compositional data. Zero values are allowed.

covar

If you have other covariates as well put themn here.

a

The value of the power transformation, it has to be between -1 and 1. If zero values are present it has to be greater than 0. If \alpha=0 the isometric log-ratio transformation is applied.

k

A number at least equal to 1. How many principal components to use.

xnew

A matrix containing the new compositional data whose response is to be predicted. If you have no new data, leave this NULL as is by default.

B

If B is greater than 1 bootstrap estimates of the standard error are returned. If B=1, no standard errors are returned.

ncores

If ncores is 2 or more parallel computing is performed. This is to be used for the case of bootstrap. If B=1, this is not taken into consideration.

tol

The tolerance value to terminate the Newton-Raphson procedure.

maxiters

The maximum number of Newton-Raphson iterations.

Details

The \alpha-transformation is applied to the compositional data first, the first k principal component scores are calcualted and used as predictor variables for the Kullback-Leibler divergence based regression model.

Value

A list including:

runtime

The time required by the regression.

iters

The number of iterations required by the Newton-Raphson in the kl.compreg function.

loglik

The log-likelihood. This is actually a quasi multinomial regression. This is bascially minus the half deviance, or - sum_{i=1}^ny_i\log{y_i/\hat{y}_i}.

be

The beta coefficients.

seb

The standard error of the beta coefficients, if bootstrap is chosen, i.e. if B > 1.

est

The fitted values of xnew if xnew is not NULL.

Author(s)

Initial code by Abdulaziz Alenazi. Modifications by Michail Tsagris.

R implementation and documentation: Abdulaziz Alenazi a.alenazi@nbu.edu.sa and Michail Tsagris mtsagris@uoc.gr.

References

Alenazi A. (2019). Regression for compositional data with compositional data as predictor variables with or without zero values. Journal of Data Science, 17(1): 219-238. https://jds-online.org/journal/JDS/article/136/file/pdf

Tsagris M. (2015). Regression analysis with compositional data containing zero values. Chilean Journal of Statistics, 6(2): 47-57. http://arxiv.org/pdf/1508.01913v1.pdf

Tsagris M.T., Preston S. and Wood A.T.A. (2011). A data-based power transformation for compositional data. In Proceedings of the 4th Compositional Data Analysis Workshop, Girona, Spain. http://arxiv.org/pdf/1106.1451.pdf

See Also

klalfapcr.tune, tflr, glm.pcr, alfapcr.tune

Examples

library(MASS)
y <- rdiri(214, runif(4, 1, 3))
x <- as.matrix(fgl[, 2:9])
x <- x / rowSums(x)
mod <- alfa.pcr(y = y, x = x, a = 0.7, k = 1)
mod

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