Estimates structured dispersion effects using approximate REML with gamma responses.
remlscoregamma(y, X, Z, mlink="log", dlink="log", trace=FALSE, tol=1e-5, maxit=40)
List with the following components:
numeric vector of regression coefficients for predicting the mean.
numeric vector of standard errors for beta.
numeric vector of regression coefficients for predicting the variance.
numeric vector of standard errors for gamma.
numeric vector of estimated means.
numeric vector of estimated dispersions.
minus twice the REML log-likelihood.
numeric vector of leverages.
numeric vector of responses.
design matrix for predicting the mean.
design matrix for predicting the variance.
character string or numeric value specifying link for mean model.
character string or numeric value specifying link for dispersion model.
logical value. If TRUE
then diagnostic information is output at each iteration.
convergence tolerance.
maximum number of iterations allowed.
This function fits a double generalized linear model (glm) with gamma responses.
As for ordinary gamma glms, a link-linear model is assumed for the expected values.
The double glm assumes a separate link-linear model for the dispersions as well.
The responses y
are assumed to follow a gamma generalized linear model with link mlink
and design matrix
X
.
The dispersions follow a link-linear model with link dlink
and design matrix Z
.
Write \(y_i\) for the \(i\)th response.
The \(y_i\) are assumed to be independent and gamma distributed with \(E(y_i) = \mu_i\) and var\((y_i)=\phi_i\mu_i^2\).
The link-linear model for the means can be written as
$$g(\mu)=X\beta$$
where \(g\) is the mean-link function defined by mlink
and \(\mu\) is the vector of means.
The dispersion link-linear model can be written as
$$h(\phi)=Z\gamma$$
where \(h\) is the dispersion-link function defined by dlink
and \(\phi\) is the vector of dispersions.
The parameters \(\gamma\) are estimated by approximate REML likelihood using an adaption of the algorithm described by Smyth (2002). See also Smyth and Verbyla (1999a,b) and Smyth and Verbyla (2009). Having estimated \(\gamma\) and \(\phi\), the \(\beta\) are estimated as usual for a gamma glm.
The estimated values for \(\beta\), \(\mu\), \(\gamma\) and \(\phi\) are return as beta
, mu
, gamma
and phi
respectively.
Smyth, G. K., and Verbyla, A. P. (1999a). Adjusted likelihood methods for modelling dispersion in generalized linear models. Environmetrics 10, 695-709. http://www.statsci.org/smyth/pubs/ties98tr.html
Smyth, G. K., and Verbyla, A. P. (1999b). Double generalized linear models: approximate REML and diagnostics. In Statistical Modelling: Proceedings of the 14th International Workshop on Statistical Modelling, Graz, Austria, July 19-23, 1999, H. Friedl, A. Berghold, G. Kauermann (eds.), Technical University, Graz, Austria, pages 66-80. http://www.statsci.org/smyth/pubs/iwsm99-Preprint.pdf
Smyth, G. K. (2002). An efficient algorithm for REML in heteroscedastic regression. Journal of Computational and Graphical Statistics 11, 836-847.
Smyth, GK, and Verbyla, AP (2009). Leverage adjustments for dispersion modelling in generalized nonlinear models. Australian and New Zealand Journal of Statistics 51, 433-448.
data(welding)
attach(welding)
y <- Strength
X <- cbind(1,(Drying+1)/2,(Material+1)/2)
colnames(X) <- c("1","B","C")
Z <- cbind(1,(Material+1)/2,(Method+1)/2,(Preheating+1)/2)
colnames(Z) <- c("1","C","H","I")
out <- remlscoregamma(y,X,Z)
Run the code above in your browser using DataLab