SGButil {SGB} | R Documentation |
Computation of scales and z-vectors
Description
bval computes the scale for each observed composition from the parameters and auxiliary variables for that observation.
zval computes the z-vector for each observed composition, i.e. the transform that is Dirichlet distributed under the SGB model for the observed composition.
Usage
bval(D, x, d, V)
zval(u, x, d, V)
Arguments
D |
number of parts |
x |
vector of parameters ( |
d |
|
u |
|
V |
|
Details
See Graf (2017), Equation (8), or the vignette "SGB regression", Equation (1).
Value
transformed composition of length D
.
References
Graf, M. (2017). A distribution on the simplex of the Generalized Beta type. In J. A. Martin-Fernandez (Ed.), Proceedings CoDaWork 2017, University of Girona (Spain), 71-90.
Examples
## Example with 2 compositions
u <- matrix(c(0.2,0.4,0.5,0.5,0.3,0.2),nrow=2,byrow=TRUE)
u
D <- NCOL(u) # number of parts
## auxiliary variable
d <- matrix(c(3.2,4.6),ncol=1)
## log-ratio transformation
V <- matrix(c(c(1,-1,0)/sqrt(2),c(1,1,-2)/sqrt(6)),ncol=2)
## vector of parameters:
shape1 <- 2.00
coefi <- c(-0.78, 0.06, 0.96, -0.11)
shape2 <- c(1.80, 3.10, 4.00)
x <-c(shape1, coefi, shape2)
bval(D,x,d,V)
zval(u,x,d,V)