drop1.HLfit | R Documentation |
Drop single terms from the model. The drop1
method for spaMM fit objects is conceived to replicate the functionality, output format and details of pre-existing methods for similar models. Results for LMs and GLMs should replicate base R drop1
results, with some exceptions:
* somewhat stricter default check of non-default scope
argument;
* Because the dispersion estimates for Gamma GLMs differ between stats::glm
and spaMM fits (see Details in method
), some tests may differ too; results from spaMM REML fits being closer than ML fits to those from glm()
fits;
* AIC values reported in tables are always the marginal AIC as computed by AIC.HLfit
, while drop1.glm
may report confusing (to me, at least) values (see AIC.HLfit
) for reasons that seem to go beyond differences in dispersion estimates.
For LMMs, ANOVA tables are provided by interfacing lmerTest::anova
(with non-default type
).
For other classes of models, a table of likelihood ratio tests is returned, each test resulting from a call to LRT
.
## S3 method for class 'HLfit'
drop1(object, scope, method="", check_marg=NULL, check_time=60, ...)
object |
Fit object returned by a spaMM fitting function. |
scope |
Default “scope” (terms to be tested, specified as a formula, see Examples) is determined by applying |
method |
Only non-default value is |
check_marg |
NULL or boolean: whether effects should be checked for marginality. By default, this check is performed when a non-default scope is specified, and then no test is reported for terms that do not satisfy the marginality condition. If |
check_time |
numeric: whether to output some information when the execution time of |
... |
Further arguments passed from or to methods, or to |
As for the ANOVA-table functionality, it has been included here mainly to provide access to F tests (including, for LMMs, the “Satterthwaite method”, using pre-existing procedures as template or backend for expediency and familiarity. The procedures for specific classes of models have various limitations, e.g., none of them handle models with variable dispersion parameter. For classes of models not well handled by these procedures (by design or due to the experimental nature of the recent implementation), method="LRT"
can still be applied (and will be applied by default for GLMMs).
The return format is that of the function called (lmerTest::drop1
for LMMs), or emulated (base drop1
methods for LMs or GLMs), or is a data frame whose rows are each the result of calling LRT
.
as_LMLT
for the interface to lmerTest::drop1
.
data("wafers")
#### GLM
wfit <- fitme(y ~ X1+X2+X1*X3+X2*X3+I(X2^2), family=Gamma(log), data=wafers)
drop1(wfit, test = "F")
drop1(wfit, test = "F", scope= ~ X1 + X1 * X3 ) # note the message!
#### LMM
if(requireNamespace("lmerTest", quietly=TRUE)) {
lmmfit <- fitme(y ~X1+X2+X1*X3+X2*X3+I(X2^2)+(1|batch),data=wafers)
drop1(lmmfit) # => Satterthwaite method here giving p-values quite close to
# traditional t-tests given by:
summary(lmmfit, details=list(p_value=TRUE))
}
#### GLMM
wfit <- fitme(y ~ X1+X2+X1*X3+X2*X3+I(X2^2)+(1|batch), family=Gamma(log),
rand.family=inverse.Gamma(log), resid.model = ~ X3+I(X3^2) , data=wafers)
drop1(wfit)
drop1(wfit, scope= ~ X1 + X1 * X3 ) # note the message!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.