# simplex: Simplex Distribution Family Function In VGAM: Vector Generalized Linear and Additive Models

## Description

The two parameters of the univariate standard simplex distribution are estimated by full maximum likelihood estimation.

## Usage

 ```1 2``` ```simplex(lmu = "logitlink", lsigma = "loglink", imu = NULL, isigma = NULL, imethod = 1, ishrinkage = 0.95, zero = "sigma") ```

## Arguments

 `lmu, lsigma` Link function for `mu` and `sigma`. See `Links` for more choices. `imu, isigma` Optional initial values for `mu` and `sigma`. A `NULL` means a value is obtained internally. `imethod, ishrinkage, zero` See `CommonVGAMffArguments` for information.

## Details

The probability density function can be written

f(y; mu, sigma) = [2* pi * sigma^2 * (y*(1-y))^3]^(-0.5) * exp[-0.5 * (y-mu)^2 / (sigma^2 * y * (1-y) * mu^2 * (1-mu)^2)]

for 0 < y < 1, 0 < mu < 1, and sigma > 0. The mean of Y is mu (called `mu`, and returned as the fitted values).

The second parameter, `sigma`, of this standard simplex distribution is known as the dispersion parameter. The unit variance function is V(mu) = mu^3 (1-mu)^3. Fisher scoring is applied to both parameters.

## Value

An object of class `"vglmff"` (see `vglmff-class`). The object is used by modelling functions such as `vglm`, and `vgam`.

## Note

This distribution is potentially useful for dispersion modelling. Numerical problems may occur when `mu` is very close to 0 or 1.

T. W. Yee

## References

Jorgensen, B. (1997). The Theory of Dispersion Models. London: Chapman & Hall

Song, P. X.-K. (2007). Correlated Data Analysis: Modeling, Analytics, and Applications. Springer.

`dsimplex`, `dirichlet`, `rig`, `binomialff`.

## Examples

 ```1 2 3 4 5 6 7 8``` ```sdata <- data.frame(x2 = runif(nn <- 1000)) sdata <- transform(sdata, eta1 = 1 + 2 * x2, eta2 = 1 - 2 * x2) sdata <- transform(sdata, y = rsimplex(nn, mu = logitlink(eta1, inverse = TRUE), dispersion = exp(eta2))) (fit <- vglm(y ~ x2, simplex(zero = NULL), data = sdata, trace = TRUE)) coef(fit, matrix = TRUE) summary(fit) ```

### Example output

```Loading required package: stats4
VGLM    linear loop  1 :  loglikelihood = 1403.1607
VGLM    linear loop  2 :  loglikelihood = 1770.2988
VGLM    linear loop  3 :  loglikelihood = 2031.2731
VGLM    linear loop  4 :  loglikelihood = 2165.0315
VGLM    linear loop  5 :  loglikelihood = 2201.6848
VGLM    linear loop  6 :  loglikelihood = 2204.1359
VGLM    linear loop  7 :  loglikelihood = 2204.143
VGLM    linear loop  8 :  loglikelihood = 2204.143

Call:
vglm(formula = y ~ x2, family = simplex(zero = NULL), data = sdata,
trace = TRUE)

Coefficients:
(Intercept):1 (Intercept):2          x2:1          x2:2
1.044088      1.050109      1.959490     -2.081057

Degrees of Freedom: 2000 Total; 1996 Residual
Log-likelihood: 2204.143
(Intercept)      1.044088       1.050109
x2               1.959490      -2.081057

Call:
vglm(formula = y ~ x2, family = simplex(zero = NULL), data = sdata,
trace = TRUE)

Pearson residuals:
Min      1Q  Median     3Q   Max
logitlink(mu)  -5.1046 -0.5203  0.1252 0.6702 2.638
loglink(sigma) -0.7072 -0.6351 -0.4048 0.2437 7.690

Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept):1  1.04409    0.02795   37.36   <2e-16 ***
(Intercept):2  1.05011    0.04516   23.25   <2e-16 ***
x2:1           1.95949    0.03260   60.10   <2e-16 ***
x2:2          -2.08106    0.07647  -27.21   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1