kl.compreg2: Helper functions for the Kullback-Leibler regression

View source: R/kl.compreg2.R

Helper functions for the Kullback-Leibler regressionR Documentation

Helper functions for the Kullback-Leibler regression

Description

Helper functions for the Kullback-Leibler regression.

Usage

kl.compreg2(y, x, con = TRUE, xnew = NULL, tol = 1e-07, maxiters = 50)
klcompreg.boot(y, x, der, der2, id, b1, n, p, d, tol = 1e-07, maxiters = 50)

Arguments

y

A matrix with the compositional data (dependent variable). Zero values are allowed. For the klcompreg.boot the first column is removed.

x

The predictor variable(s), they can be either continuous or categorical or both. In the klcompreg.boot this is the design matrix.

con

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

xnew

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

tol

The tolerance value to terminate the Newton-Raphson procedure.

maxiters

The maximum number of Newton-Raphson iterations.

der

An vector to put the first derivative there.

der2

An empty matrix to put the second derivatives there, the Hessian matrix will be put here.

id

A help vector with indices.

b1

The matrix with the initial estimated coefficients.

n

The sample size

p

The number of columns of the design matrix.

d

The dimensionality of the simplex, that is the number of columns of the compositional data minus 1.

Details

These are help functions for the kl.compreg function. They are not to be called directly by the user.

Value

For kl.compreg2 a list including:

iters

The nubmer of iterations required by the Newton-Raphson.

loglik

The loglikelihood.

be

The beta coefficients.

est

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

For klcompreg.boot a list including:

loglik

The loglikelihood.

be

The beta coefficients.

Author(s)

Michail Tsagris.

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

References

Murteira, Jose MR, and Joaquim JS Ramalho 2016. Regression analysis of multivariate fractional data. Econometric Reviews 35(4): 515-552.

See Also

diri.reg, js.compreg, ols.compreg, comp.reg

Examples

  library(MASS)
  x <- as.vector(fgl[, 1])
  y <- as.matrix(fgl[, 2:9])
  y <- y / rowSums(y)
  mod1<- kl.compreg(y, x, B = 1, ncores = 1)
  mod2 <- js.compreg(y, x, B = 1, ncores = 1)

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