Learn R Programming

SGB (version 1.0.1.1)

SGButil: 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)

Value

transformed composition of length \(D\).

Arguments

D

number of parts

x

vector of parameters (shape1,coefi,shape2) where shape1 is the overall shape, coefi is the vector of regression coefficients (see initpar.SGB) and shape2 the vector of \(D\) Dirichlet shape parameters

d

\((n \times m)\) - data matrix of explanatory variables (variables corresponding to coefi); \(n\): sample size, \(m\): number of auxiliary variables

u

\((n \times D)\) - data matrix of compositions (independent variables); \(D\): number of parts

V

\(D \times (D-1)\) - matrix specifying the full rank transformation of log(parts) into log-ratios

Details

See Graf (2017), Equation (8), or the vignette "SGB regression", Equation (1).

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

Run this code

## 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)

Run the code above in your browser using DataLab