amlexponential(w.aml = 1, parallel = FALSE, imethod = 1, digw = 4,
link = "loge", earg = list())
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 Round
as the digits
argument
for the w.aml
values;
used cosmetically for labelling.exponential
and the warning below."vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
and vgam
.link
argument of exponential
and
amlexponential
are currently different: one is the
rate parameter and the other is the mean (expectile) parameter. 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).
exponential
) but the usual deviance is replaced by an
asymmetric squared error loss function; it is multiplied by
$w.aml$ for positive residuals.
The solution is the set of regression coefficients that minimize the
sum of these deviance-type values over the data set, weighted by
the weights
argument (so that it can contain frequencies).
Newton-Raphson estimation is used here.exponential
,
amlbinomial
,
amlpoisson
,
amlnormal
,
alaplace1
,
lms.bcg
,
deexp
.nn = 2000
mydat = data.frame(x = seq(0, 1, length=nn))
mydat = transform(mydat, mu = loge(-0+1.5*x+0.2*x^2, inverse=TRUE))
mydat = transform(mydat, mu = loge(0-sin(8*x), inverse=TRUE))
mydat = transform(mydat, y = rexp(nn, rate=1/mu))
(fit = vgam(y ~ s(x,df=5), amlexponential(w=c(0.001,0.1,0.5,5,60)),
mydat, trace=TRUE))
fit@extra
# These plots are against the sqrt scale (to increase clarity)
par(mfrow=c(1,2))
# Quantile plot
with(mydat, plot(x, sqrt(y), col="blue", las=1, main=
paste(paste(round(fit@extra$percentile, dig=1), collapse=", "),
"percentile-expectile curves")))
with(mydat, matlines(x, sqrt(fitted(fit)), lwd=2, col="blue", lty=1))
# Compare the fitted expectiles with the quantiles
with(mydat, plot(x, sqrt(y), col="blue", las=1, main=
paste(paste(round(fit@extra$percentile, dig=1), collapse=", "),
"percentile curves are red")))
with(mydat, matlines(x, sqrt(fitted(fit)), lwd=2, col="blue", lty=1))
for(ii in fit@extra$percentile)
with(mydat, matlines(x, sqrt(qexp(p=ii/100, rate=1/mu)), col="red"))
Run the code above in your browser using DataLab