Binomial quantile regression estimated by maximizing an asymmetric likelihood function.
amlbinomial(w.aml = 1, parallel = FALSE, digw = 4, link = "logitlink")
An object of class "vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
and vgam
.
Numeric, a vector of positive constants controlling the percentiles. The larger the value the larger the fitted percentile value (the proportion of points below the ``w-regression plane''). The default value of unity results in the ordinary maximum likelihood (MLE) solution.
If w.aml
has more than one value then
this argument allows the quantile curves to differ by the same amount
as a function of the covariates.
Setting this to be TRUE
should force the quantile curves to
not cross (although they may not cross anyway).
See CommonVGAMffArguments
for more information.
Passed into Round
as the digits
argument
for the w.aml
values;
used cosmetically for labelling.
See binomialff
.
Thomas W. Yee
If w.aml
has more than one value then the value returned by
deviance
is the sum of all the (weighted) deviances taken over
all the w.aml
values. See Equation (1.6) of Efron (1992).
The general methodology behind this VGAM family function
is given in Efron (1992) and full details can be obtained there.
This model is essentially a logistic regression model
(see binomialff
) but the usual deviance is
replaced by an
asymmetric squared error loss function; it is multiplied by
weights
argument (so that it can contain frequencies).
Newton-Raphson estimation is used here.
Efron, B. (1992). Poisson overdispersion estimates based on the method of asymmetric maximum likelihood. Journal of the American Statistical Association, 87, 98--107.
amlpoisson
,
amlexponential
,
amlnormal
,
extlogF1
,
alaplace1
,
denorm
.
# Example: binomial data with lots of trials per observation
set.seed(1234)
sizevec <- rep(100, length = (nn <- 200))
mydat <- data.frame(x = sort(runif(nn)))
mydat <- transform(mydat,
prob = logitlink(-0 + 2.5*x + x^2, inverse = TRUE))
mydat <- transform(mydat, y = rbinom(nn, size = sizevec, prob = prob))
(fit <- vgam(cbind(y, sizevec - y) ~ s(x, df = 3),
amlbinomial(w = c(0.01, 0.2, 1, 5, 60)),
mydat, trace = TRUE))
fit@extra
if (FALSE) {
par(mfrow = c(1,2))
# Quantile plot
with(mydat, plot(x, jitter(y), col = "blue", las = 1, main =
paste(paste(round(fit@extra$percentile, digits = 1), collapse = ", "),
"percentile-expectile curves")))
with(mydat, matlines(x, 100 * fitted(fit), lwd = 2, col = "blue", lty=1))
# Compare the fitted expectiles with the quantiles
with(mydat, plot(x, jitter(y), col = "blue", las = 1, main =
paste(paste(round(fit@extra$percentile, digits = 1), collapse = ", "),
"percentile curves are red")))
with(mydat, matlines(x, 100 * fitted(fit), lwd = 2, col = "blue", lty = 1))
for (ii in fit@extra$percentile)
with(mydat, matlines(x, 100 *
qbinom(p = ii/100, size = sizevec, prob = prob) / sizevec,
col = "red", lwd = 2, lty = 1))
}
Run the code above in your browser using DataLab