Non linear least squares regression for compositional data.
ols.compreg(y, x, B = 1, ncores = 1, xnew = NULL)
A matrix with the compositional data (dependent variable). Zero values are allowed.
The predictor variable(s), they have to be continuous.
If B is greater than 1 bootstrap estimates of the standard error are returned. If B=1, no standard errors are returned.
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.
If you have new data use it, otherwise leave it NULL.
A list including:
The time required by the regression.
The beta coefficients.
The covariance matrix of the beta coefficients, if bootstrap is chosen, i.e. if B > 1.
The fitted of xnew if xnew is not NULL.
The ordinary least squares between the observed and the fitted compositional data is adopted as the objective function. This involves numerical optimization since the relationship is non linear. There is no log-likelihood.
Murteira, Jose MR, and Joaquim JS Ramalho 2016. Regression analysis of multivariate fractional data. Econometric Reviews 35(4): 515-552.
diri.reg, js.compreg, kl.compreg, comp.reg, comp.reg, alfa.reg
# NOT RUN {
library(MASS)
x <- as.vector(fgl[, 1])
y <- as.matrix(fgl[, 2:9])
y <- y / rowSums(y)
mod1 <- ols.compreg(y, x, B = 1, ncores = 1)
mod2 <- js.compreg(y, x, B = 1, ncores = 1)
# }
Run the code above in your browser using DataLab