Learn R Programming

wle (version 0.9-91)

wle.glm.weights: Weights based on Weighted Likelihood for the GLM model

Description

Evaluate the weights for a given GLM model

Usage

wle.glm.weights(y, x, fitted.values, family = gaussian(), dispersion = 1, raf = "GKL", tau = 0.1, smooth = NULL, asy.smooth=0.031, window.size = NULL, use.asymptotic = NULL, use.smooth=TRUE, tol=10^(-6), dist.method = "euclidean", cutpoint = 0, powerdown = 1)

Arguments

y
y is a vector of observations of length n.
x
x is a design matrix of dimension n * p.
fitted.values
the fitted mean values, obtained by transforming the linear predictors by the inverse of the link function. Often obtain as a result of wle.glm.fit call.
family
a description of the error distribution and link function to be used in the model. This can be a character string naming a family function, a family function or the result of a call to a family function. (See family for details of family functions.)
dispersion
value of the dispersion parameter. Used only in the Gamma family for now.
raf
type of Residual adjustment function to be used:

raf="GKL": Generalized Kullback-Leibler family RAF (see details),

raf="PWD": Power Divergence family RAF (see details),

raf="HD": Hellinger Distance RAF,

raf="NED": Negative Exponential Disparity RAF,

raf="SCHI2": Symmetric Chi-Squared Disparity RAF.

tau
positive real. Used in selecting the member of the RAF family in the case of GKL or PWD.
smooth
the value of the smoothing parameter; used in the case of continuous models.
asy.smooth
the value of the smoothing parameter; used in the evaluation of asymptotic weights.
window.size
positive real or NULL. The observations with a distance, in the predictors space, less than this threshold are used to estimate the conditional distribution for a given level of the predictor.
use.asymptotic
interger or NULL. The minimum number of observations for the level of the predictors under which asymptotic weights are used.
use.smooth
if TRUE the smoothed model is used in the computation of the Pearson Residuals. For now, the option is used only for the Gamma family.
tol
the tolerance used in the numerical calculations. For now, the option is used only for the Gamma family.
dist.method
distance method passed to dist to measure the distance between predictor rows.
cutpoint
a value in the interval [0,1].
powerdown
a non negative number.

Value

A list with two components
weights
the weights associated to the observations.
asy
logical. If TRUE the corresponding weights is evaluated using asymptotic considerations based on Anscombe residuals.

References

Agostinelli, C. and Al-quallaf, F. (2009) Robust inference in Generalized Linear Models. Manuscript in preparation.

See Also

wle.glm

Examples

Run this code

# tau=0.1
wgr.D93 <- extractRoot(wle.glm.D93)
# tau=0.2
w1wgr.D93 <- wle.glm.weights(y = wgr.D93$y, x = wgr.D93$x,
  fitted.values = wgr.D93$fitted.values, family = wgr.D93$family,
  raf = "GKL", tau = 0.2, smooth = 0.031, window.size = NULL,
  use.asymptotic = NULL, dist.method = "euclidean")
# tau=0.3
w2wgr.D93 <- wle.glm.weights(y = wgr.D93$y, x = wgr.D93$x,
  fitted.values = wgr.D93$fitted.values, family = wgr.D93$family,
  raf = "GKL", tau = 0.3, smooth = 0.031, window.size = NULL,
  use.asymptotic = NULL, dist.method = "euclidean")

plot(wgr.D93$wle.weights, ylim=c(0,1), ylab='Weights')
points(w1wgr.D93$weights, col=2)
points(w2wgr.D93$weights, col=3)
legend('bottomright', legend=expression(tau==0.1, tau==0.2, tau==0.3),
  pch=rep(1,3), col=1:3, inset=0.05)

Run the code above in your browser using DataLab