Helper functions for the Kullback-Leibler regression {Compositional} | R Documentation |
Helper functions for the Kullback-Leibler regression.
kl.compreg2(y, x, xnew = NULL, tol = 1e-07, maxiters = 50) klcompreg.boot(y, x, der, der2, id, b1, n, p, d, tol = 1e-07, maxiters = 50)
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, with the ones in the first column. |
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. |
These are help functions for the kl.compreg
function. They are not to be called directly by the user.
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. |
Michail Tsagris
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr
Murteira, Jose MR, and Joaquim JS Ramalho 2016. Regression analysis of multivariate fractional data. Econometric Reviews 35(4): 515-552.
diri.reg, js.compreg, ols.compreg, comp.reg
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)