emmGrid
objectObjects of class emmGrid
contain several settings that affect such things as
what arguments to pass to summary.emmGrid
.
The update
method allows safer management of these settings than
by direct modification of its slots.
# S3 method for emmGrid
update(object, ..., silent = FALSE)
An emmGrid
object
Options to be set. These must match a list of known options (see Details)
Logical value. If FALSE
(the default), a message is
displayed if any options are not matched. If TRUE
, no messages are
shown.
an updated emmGrid
object.
The names in …
are partially matched against those that are valid, and if a match is found, it adds or replaces the current setting. The valid names are
tran
, tran2
(list
or character
) specifies
the transformation which, when inverted, determines the results displayed by
summary.emmGrid
, predict.emmGrid
, or emmip
when
type="response"
. The value may be the name of a standard
transformation from make.link
or additional ones supported by
name, such as "log2"
; or, for a custom transformation, a list
containing at least the functions linkinv
(the inverse of the
transformation) and mu.eta
(the derivative thereof). The
make.tran
function returns such lists for a number of popular
transformations. See the help page of make.tran
for details as
well as information on the additional named transformations that are
supported. tran2
is just like tran
except it is a second
transformation (i.e., a response transformation in a generalized linear
model).
tran.mult
Multiple for tran
. For example, for the
response transformation 2*sqrt(y) (or sqrt(y) + sqrt(y + 1),
for that matter), we should have tran = "sqrt"
and tran.mult =
2
. If absent, a multiple of 1 is assumed.
tran.offset
Additive constant before a transformation is applied.
For example, a response transformation of log(y + pi)
has
tran.offset = pi
. If no value is present, an offset of 0 is assumed.
estName
(character
) is the column label used for
displaying predictions or EMMs.
inv.lbl
(character)
) is the column label to use for
predictions or EMMs when type="response"
.
by.vars
(character)
vector or NULL
) the variables
used for grouping in the summary, and also for defining subfamilies in a call
to contrast
.
pri.vars
(character
vector) are the names of the grid
variables that are not in by.vars
. Thus, the combinations of their
levels are used as columns in each table produced by summary.emmGrid
.
alpha
(numeric) is the default significance level for tests, in
summary.emmGrid
as well as plot.emmGrid
when CIs = TRUE. Be cautious that methods that depend on
specifying alpha
are prone to abuse. See the
discussion in vignette("basics", "emmeans")
.
adjust
(character)
) is the default for the adjust
argument in summary.emmGrid
.
famSize
(integer) is the number of means involved in a family of inferences; used in Tukey adjustment
infer
(logical
vector of length 2) is the default value
of infer
in summary.emmGrid
.
level
(numeric) is the default confidence level, level
,
in summary.emmGrid
. Note: You must specify all five letters
of ‘level’ to distinguish it from the slot name ‘levels’.
df
(numeric) overrides the default degrees of freedom with a specified single value.
null
(numeric) null hypothesis for summary
or
test
(taken to be zero if missing).
side
(numeric or character) side
specification for for
summary
or test
(taken to be zero if missing).
sigma
(numeric) Error SD to use in predictions and for bias-adjusted back-transformations
delta
(numeric) delta
specification for summary
or test
(taken to be zero if missing).
predict.type
or type
(character) sets the default method
of displaying predictions in summary.emmGrid
,
predict.emmGrid
, and emmip
. Valid values are
"link"
(with synonyms "lp"
and "linear"
), or
"response"
.
bias.adjust
, frequentist
(character) These
are used by summary
if the value of these arguments are not specified.
estType
(character
) is used internally to determine
what adjust
methods are appropriate. It should match one of
c("prediction", "contrast", "pairs"). As an example of why this is needed,
the Tukey adjustment should only be used for pairwise comparisons
(estType = "pairs"
); if estType
is some other string, Tukey
adjustments are not allowed.
avgd.over
(character)
vector) are the names of the
variables whose levels are averaged over in obtaining marginal averages of
predictions, i.e., estimated marginal means. Changing this might produce a
misleading printout, but setting it to character(0)
will suppress the
“averaged over” message in the summary.
initMesg
(character
) is a string that is added to the
beginning of any annotations that appear below the summary.emmGrid
display.
methDesc
(character
) is a string that may be used for
creating names for a list of emmGrid
objects.
nesting
(Character or named list
) specifies the nesting
structure. See “Recovering or overriding model information” in the
documentation for ref_grid
. The current nesting structure is
displayed by str.emmGrid
.
levels
named list
of new levels for the elements of the
current emmGrid
. The list name(s) are used as new variable names, and
if needed, the list is expanded using expand.grid
. These results replace
current variable names and levels. This specification changes the levels
,
grid
, roles
, and misc
slots in the updated emmGrid
,
and resets pri.vars
, by.vars
, adjust
, famSize
,
avgd.over
, and nesting
.
Note: All six letters of levels
is needed in order to distinguish
it from level
.
If the name matches an element of
slotNames(object)
other than levels
, that slot is replaced by
the supplied value, if it is of the required class (otherwise an error occurs).
The user must be very careful in
replacing slots because they are interrelated; for example, the lengths
and dimensions of grid
, linfct
, bhat
, and V
must
conform.
# NOT RUN {
# Using an already-transformed response:
mypigs <- transform(pigs, logconc = log(pigs$conc))
mypigs.lm <- lm(logconc ~ source + factor(percent), data = mypigs)
# Reference grid that knows about the transformation:
mypigs.rg <- update(ref_grid(mypigs.lm), tran = "log",
predict.type = "response")
emmeans(mypigs.rg, "source")
# }
Run the code above in your browser using DataLab