InitialParameters {SGB} | R Documentation |
Initial parameters estimates and comparison
Description
initpar.SGB
computes an initial vector of parameters.
condshape2
computes the shape2
parameters by the same method as initpar.SGB
, but from an arbitrary set of parameters (shape1
,coefi
) (e.g. the result of a SGB regression fit). These approximations are compared with the shape2
estimates.
compushape2
is internally called by initpar.SGB
and condshape2
. It computes shape2
parameters in function of shape1
and given regression parameters coefi
.
Usage
initpar.SGB(d, u, V, weight = rep(1, dim(u)[1]), shape1 = 1, Mean2 = TRUE)
condshape2(x,d,u,V)
compushape2(shape1, coefi, d, u, V)
Arguments
d |
data matrix of explanatory variables (without constant vector) |
u |
data matrix of compositions (independent variables) |
V |
full rank transformation of log(parts) into log-ratios, matrix |
weight |
vector of length |
shape1 |
positive number, overall shape parameter |
Mean2 |
logical, if TRUE (default), the computed |
coefi |
vector of regression coefficients of length |
x |
fitted SGB regression parameters, see |
Details
The main function here is initpar.SGB
. The initial value of shape1
must be specified by the user; by default, it takes the value 1.
In the initial regression model, each column of
log(u) % * % V
is regressed by OLS on the columns of d
. coefi
is the vector of regression parameters, first the D-1
terms associated with the first explanatory variable in d
, and so on similarily for each explanatory variable. The initial scale compositions are computed by back-transforming the predicted values to the simplex and used to compute the vector z=C[(u/scale)^{shape1}]
, where C[.]
is the closure operation. Wicker et al. (2008), see also Ng et al. (2011) p.74-75, describe a procedure to find initial values for the shape parameters in a Dirichlet distribution. Their method is used on the (approximate) Dirichlet vector z
.
Value
initpar.SGB
:
vector of length (1+ (D-1)*(m+1) + D)
containing initial values for (shape1
,coefi
,shape2
).
condshape2
:
list with two components: 1. title and 2. data-frame with 2 columns: fitted shape2
and Wicker's approximation.
References
Wicker, N., J. Muller, R. K. R. Kalathur, and O. Poch (2008). A maximum likelihood approximation method for Dirichlet's parameter estimation. Computational Statistics & Data Analysis 52 (3), 1315-1322.
Kai Wang Ng, Guo-Liang Tian, Man-Lai Tang (2011). Dirichlet and Related Distributions: Theory, Methods and Applications. Wiley Series in Probability and Statistics.
Examples
## Explanatory variable
da <- data.frame(l.depth=log(arc[["depth"]]))
damat <- as.matrix(da)
## Compositions
ua <- arc[,1:3]
## alr transforms
Va <- matrix(c(1,0,-1,0,1,-1),nrow=3)
colnames(Va) <- c("alr1","alr2")
Va
## Initial values
initpar.SGB(damat,ua,Va)
initpar.SGB(damat,ua,Va,Mean2=FALSE)
## Conditional shape2 values; same as parameters computed with initpar
condshape2(initpar.SGB(damat,ua,Va,Mean2=FALSE),damat,ua,Va)
## Comparison with fitted parameters
oa <- regSGB(damat, as.matrix(ua), Va)
condshape2(oa[["par"]],damat,ua,Va)