# betaprime: The Beta-Prime Distribution In VGAM: Vector Generalized Linear and Additive Models

## Description

Estimation of the two shape parameters of the beta-prime distribution by maximum likelihood estimation.

## Usage

 `1` ```betaprime(lshape = "loglink", ishape1 = 2, ishape2 = NULL, zero = NULL) ```

## Arguments

 `lshape` Parameter link function applied to the two (positive) shape parameters. See `Links` for more choices. `ishape1, ishape2, zero` See `CommonVGAMffArguments`.

## Details

The beta-prime distribution is given by

f(y) = y^(shape1-1) * (1+y)^(-shape1-shape2) / B(shape1,shape2)

for y > 0. The shape parameters are positive, and here, B is the beta function. The mean of Y is shape1 / (shape2-1) provided shape2>1; these are returned as the fitted values.

If Y has a Beta(shape1,shape2) distribution then Y/(1-Y) and (1-Y)/Y have a Betaprime(shape1,shape2) and Betaprime(shape2,shape1) distribution respectively. Also, if Y1 has a gamma(shape1) distribution and Y2 has a gamma(shape2) distribution then Y1/Y2 has a Betaprime(shape1,shape2) distribution.

## Value

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

## Note

The response must have positive values only.

The beta-prime distribution is also known as the beta distribution of the second kind or the inverted beta distribution.

Thomas W. Yee

## References

Johnson, N. L. and Kotz, S. and Balakrishnan, N. (1995). Chapter 25 of: Continuous Univariate Distributions, 2nd edition, Volume 2, New York: Wiley.

`betaff`, `Beta`.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20``` ```nn <- 1000 bdata <- data.frame(shape1 = exp(1), shape2 = exp(3)) bdata <- transform(bdata, yb = rbeta(nn, shape1, shape2)) bdata <- transform(bdata, y1 = (1-yb) / yb, y2 = yb / (1-yb), y3 = rgamma(nn, exp(3)) / rgamma(nn, exp(2))) fit1 <- vglm(y1 ~ 1, betaprime, data = bdata, trace = TRUE) coef(fit1, matrix = TRUE) fit2 <- vglm(y2 ~ 1, betaprime, data = bdata, trace = TRUE) coef(fit2, matrix = TRUE) fit3 <- vglm(y3 ~ 1, betaprime, data = bdata, trace = TRUE) coef(fit3, matrix = TRUE) # Compare the fitted values with(bdata, mean(y3)) head(fitted(fit3)) Coef(fit3) # Useful for intercept-only models ```

### Example output

```Loading required package: stats4
VGLM    linear loop  1 :  loglikelihood = -4851.1764
VGLM    linear loop  2 :  loglikelihood = -4231.4919
VGLM    linear loop  3 :  loglikelihood = -3762.7586
VGLM    linear loop  4 :  loglikelihood = -3453.2754
VGLM    linear loop  5 :  loglikelihood = -3317.4691
VGLM    linear loop  6 :  loglikelihood = -3294.3972
VGLM    linear loop  7 :  loglikelihood = -3293.8067
VGLM    linear loop  8 :  loglikelihood = -3293.8064
VGLM    linear loop  9 :  loglikelihood = -3293.8064
loge(shape1) loge(shape2)
(Intercept)     2.910746    0.9035843
VGLM    linear loop  1 :  loglikelihood = -8611.1252
VGLM    linear loop  2 :  loglikelihood = -7611.3333
VGLM    linear loop  3 :  loglikelihood = -6611.8984
VGLM    linear loop  4 :  loglikelihood = -5613.4311
VGLM    linear loop  5 :  loglikelihood = -4617.5721
VGLM    linear loop  6 :  loglikelihood = -3628.6468
VGLM    linear loop  7 :  loglikelihood = -2657.505
VGLM    linear loop  8 :  loglikelihood = -1728.2805
VGLM    linear loop  9 :  loglikelihood = -882.62024
VGLM    linear loop  10 :  loglikelihood = -166.4726
VGLM    linear loop  11 :  loglikelihood = 395.04353
VGLM    linear loop  12 :  loglikelihood = 795.12551
VGLM    linear loop  13 :  loglikelihood = 1022.0082
VGLM    linear loop  14 :  loglikelihood = 1091.8949
VGLM    linear loop  15 :  loglikelihood = 1097.6016
VGLM    linear loop  16 :  loglikelihood = 1097.6371
VGLM    linear loop  17 :  loglikelihood = 1097.6371
loge(shape1) loge(shape2)
(Intercept)    0.9035843     2.910746
VGLM    linear loop  1 :  loglikelihood = -2246.7434
VGLM    linear loop  2 :  loglikelihood = -1904.7333
VGLM    linear loop  3 :  loglikelihood = -1710.8825
VGLM    linear loop  4 :  loglikelihood = -1659.5647
VGLM    linear loop  5 :  loglikelihood = -1656.6163
VGLM    linear loop  6 :  loglikelihood = -1656.6072
VGLM    linear loop  7 :  loglikelihood = -1656.6072
loge(shape1) loge(shape2)
(Intercept)     3.023821     2.006145
 3.190811
[,1]
[1,] 3.196742
[2,] 3.196742
[3,] 3.196742
[4,] 3.196742
[5,] 3.196742
[6,] 3.196742
shape1    shape2
20.569748  7.434598
```

VGAM documentation built on Jan. 16, 2021, 5:21 p.m.