This method extracts or computes a variance-covariance matrix for use in approximate inference on estimable parameter combinations in a generalized nonlinear model.
## S3 method for class 'gnm' vcov(object, dispersion = NULL, with.eliminate = FALSE, ...)
a model object of class
the dispersion parameter for the fitting family. By
default it is obtained from
logical; should parts of the variance-covariance matrix corresponding to eliminated coefficients be computed?
The resultant matrix does not itself necessarily
contain variances and covariances, since
gnm typically works
with over-parameterized model representations in which parameters are
not all identified. Rather, the resultant matrix is to be used as
the kernel of quadratic forms which are the variances or
covariances for estimable parameter combinations.
The matrix values are scaled by
dispersion. If the dispersion
is not specified, it is taken as
1 for the
Poisson families, and otherwise estimated by the residual
Chi-squared statistic divided by the residual degrees of freedom. The
dispersion used is returned as an attribute of the matrix.
The dimensions of the matrix correspond to the non-eliminated
coefficients of the
"gnm" object. If
TRUE then setting can sometimes give appreciable
speed gains; see
gnm for details of the
use.eliminate argument is currently ignored if the
model has full rank.
A matrix with number of rows/columns equal to
length(coef(object)). If there are eliminated coefficients and
use.eliminate = TRUE, the matrix will have the following
a matrix of covariances between the eliminated and non-eliminated parameters.
a vector of variances corresponding to the eliminated parameters.
gnm class includes generalized linear models, and it
should be noted that the
vcov.gnm differs from that of
vcov.glm drops all rows and columns which
NA values in
keeps those columns (which are full of zeros, since the
represents a parameter which is fixed either by use of the
constrain argument to
gnm or by a convention to handle
Turner, H and Firth, D (2005). Generalized nonlinear models in R: An overview of the gnm package. At https://cran.r-project.org
set.seed(1) ## Fit the "UNIDIFF" mobility model across education levels unidiff <- gnm(Freq ~ educ*orig + educ*dest + Mult(Exp(educ), orig:dest), family = poisson, data = yaish, subset = (dest != 7)) ## Examine the education multipliers (differences on the log scale): ind <- pickCoef(unidiff, "[.]educ") educMultipliers <- getContrasts(unidiff, rev(ind)) ## Now get the same standard errors using a suitable set of ## quadratic forms, by calling vcov() directly: cmat <- contr.sum(ind) sterrs <- sqrt(diag(t(cmat) %*% vcov(unidiff)[ind, ind] %*% cmat)) all(sterrs == (educMultipliers$SE)[-1]) ## TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.