Description Usage Arguments Details Value References Examples
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
.
1 2 3 | 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)
|
d |
data matrix of explanatory variables (without constant vector) (n \times m); n: sample size, m: number of auxiliary variables |
u |
data matrix of compositions (independent variables) (n \times D); D: number of parts |
V |
full rank transformation of log(parts) into log-ratios, matrix D \times (D-1) |
weight |
vector of length n; positive observation weights, default |
shape1 |
positive number, overall shape parameter |
Mean2 |
logical, if TRUE (default), the computed |
coefi |
vector of regression coefficients of length (m+1)*(D-1), resp. D-1 constants, then D-1 coef. of the 1st expl. variable,..., D-1 coef. of the m-th expl. variable |
x |
fitted SGB regression parameters, see |
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.
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.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.