betaff {VGAM} | R Documentation |
Estimation of the mean and precision parameters of the beta distribution.
betaff(A = 0, B = 1, lmu = if (A == 0 & B == 1) "logit" else "elogit", lphi = "loge", emu = if (lmu == "elogit") list(min = A, max = B) else list(), ephi = list(), imu = NULL, iphi = NULL, imethod = 1, zero = NULL)
A, B |
Lower and upper limits of the distribution. The defaults correspond to the standard beta distribution where the response lies between 0 and 1. |
lmu, lphi |
Link function for the mean and precision parameters.
See below for more details.
See |
emu, ephi |
List. Extra argument for the respective links.
See |
imu, iphi |
Optional initial value for the mean and precision parameters
respectively. A |
imethod, zero |
See |
The two-parameter beta distribution can be written f(y) =
(y-A)^(mu1*phi-1) * (B-y)^((1-mu1)*phi-1) / [beta(mu1*phi,(1-mu1)*phi) * (B-A)^(phi-1)]
for A < y < B, and beta(.,.) is the beta function
(see beta
).
The parameter mu1 satisfies
mu1 = (mu - A) / (B-A)
where mu is the mean of Y.
That is, mu1 is the mean of of a standard beta distribution:
E(Y) = A + (B-A)*mu1,
and these are the fitted values of the object.
Also, phi is positive and A < mu < B.
Here, the limits A and B are known.
Another parameterization of the beta distribution involving the raw
shape parameters is implemented in beta.ab
.
For general A and B, the variance of Y is (B-A)^2 * mu1 * (1-mu1) / (1+phi). Then phi can be interpreted as a precision parameter in the sense that, for fixed mu, the larger the value of phi, the smaller the variance of Y. Also, mu1=shape1/(shape1+shape2) and phi = shape1+shape2.
Fisher scoring is implemented.
If A and B are unknown then the VGAM family function
beta4()
can be used to estimate these too.
An object of class "vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
,
and vgam
.
The response must have values in the interval (A, B).
Thomas W. Yee
Ferrari, S. L. P. and Francisco C.-N. (2004) Beta regression for modelling rates and proportions. Journal of Applied Statistics, 31, 799–815.
Documentation accompanying the VGAM package at http://www.stat.auckland.ac.nz/~yee contains further information and examples.
beta.ab
,
Beta
,
genbetaII
,
betaII
,
betabinomial.ab
,
betageometric
,
betaprime
,
rbetageom
,
rbetanorm
,
kumar
,
beta4
,
elogit
.
bdata = data.frame(y = rbeta(nn <- 1000, shape1 = exp(0), shape2 = exp(1))) fit = vglm(y ~ 1, betaff, bdata, trace = TRUE) coef(fit, matrix = TRUE) Coef(fit) # Useful for intercept-only models # General A and B, and with a covariate bdata = transform(bdata, x2 = runif(nn)) bdata = transform(bdata, mu = logit(0.5 - x2, inverse = TRUE), prec = exp(3 + x2)) # prec == phi bdata = transform(bdata, shape2 = prec * (1-mu), shape1 = mu * prec) bdata = transform(bdata, y = rbeta(nn, shape1 = shape1, shape2 = shape2)) bdata = transform(bdata, Y = 5 + 8 * y) # From 5 to 13, not 0 to 1 fit = vglm(Y ~ x2, betaff(A = 5, B = 13), bdata, trace = TRUE) coef(fit, matrix = TRUE)