The emmGrid class encapsulates linear functions of regression
parameters, defined over a grid of predictors. This includes reference
grids and grids of marginal means thereof (aka estimated marginal means).
Objects of class `emmGrid` may be used independently of the underlying model
object. Instances are created primarily by ref_grid and
emmeans, and several related functions.
Slots
model.infolist. Contains the elements
call(the call that produced the model),terms(itstermsobject), andxlev(factor-level information)roleslist. Contains at least the elements
predictors,responses, andmultresp. Each is a character vector of names of these variables.griddata.frame. Contains the combinations of the variables that define the reference grid. In addition, there is an auxiliary column named
".wgt."holding the observed frequencies or weights for each factor combination (excluding covariates). If the model has one or moreoffset()calls, there is an another auxiliary column named".offset.". Auxiliary columns are not considered part of the reference grid. (However, any variables included inoffsetcalls are in the reference grid.)levelslist. Each entry is a character vector with the distinct levels of each variable in the reference grid. Note that
gridis obtained by applying the functionexpand.gridto this listmatlevslist. Like
levelsbut has the levels of any matrices in the original dataset. Matrix columns are always concatenated and treated as a single variable for purposes of the reference gridlinfctmatrix. Each row consists of the linear function of the regression coefficients for predicting its corresponding element of the reference grid. The rows of this matrix go in one-to-one correspondence with the rows of
grid, and the columns with elements ofbhat.bhatnumeric. The regression coefficients. If there is a multivariate response, the matrix of coefficients is flattened to a single vector, and
linfctandVredefined appropriately. Important:bhatmust include anyNAvalues produced as a result of collinearity in the predictors. These are taken care of later in the estimability check.nbasismatrix. The basis for the non-estimable functions of the regression coefficients. Every EMM will correspond to a linear combination of rows of
linfct, and that result must be orthogonal to all the columns ofnbasisin order to be estimable. If everything is estimable,nbasisshould be a 1 x 1 matrix ofNA.Vmatrix. The symmetric variance-covariance matrix of
bhatdffunfunction having two arguments.
dffun(k, dfargs)should return the degrees of freedom for the linear functionsum(k*bhat), orNAif unavailabledfargslist. Used to hold any additional information needed by
dffun.misclist. Additional information used by methods. These include at least the following:
estName(the label for the estimates of linear functions), and the default values ofinfer,level, andadjustto be used in thesummary.emmGridmethod. Elements in this slot may be modified if desired using theupdate.emmGridmethod.post.betamatrix. A sample from the posterior distribution of the regression coefficients, if MCMC methods were used; or a 1 x 1 matrix of
NAotherwise. When it is non-trivial, theas.mcmc.emmGridmethod returnspost.beta %*% t(linfct), which is a sample from the posterior distribution of the EMMs.
Methods
All methods for these objects are S3 methods except for show.
They include [.emmGrid, as.glht.emmGrid,
as.mcmc.emmGrid, as.mcmc.list.emmGrid (see coda),
cld.emmGrid (see multcomp),
coef.emmGrid, confint.emmGrid,
contrast.emmGrid, pairs.emmGrid,
plot.emmGrid, predict.emmGrid, print.emmGrid,
rbind.emmGrid, show.emmGrid, str.emmGrid,
summary.emmGrid, test.emmGrid,
update.emmGrid, vcov.emmGrid, and
xtable.emmGrid
