Description Usage Arguments Value Methods (by class) See Also Examples
View source: R/lrtest_removeTerm.R
Runs model without 'removeTerm' and performs likelihood ratio test for full model vs nested model. 'function(variable)' - eg, 'rcs(age, 3)' - is considered one term, as are all levels of a categorical variable.
1 2 3 4 5 6 7 | lrtest_removeTerm(orgModel, removeTerm, ...)
## Default S3 method:
lrtest_removeTerm(orgModel, removeTerm)
## S3 method for class 'mira'
lrtest_removeTerm(orgModel, removeTerm, miceObjName)
|
orgModel |
Model object containing full model. |
removeTerm |
Character string of term(s) to be removed. |
... |
Additional arguments specific to method. |
miceObjName |
Character string; name of 'mice' object. |
orgModel |
Model object containing full model. |
removeTerm |
Character string of term(s) to be removed. |
orgModel |
Model object containing full model. |
removeTerm |
Character string of term(s) to be removed. |
List with following values from lrtest() or pool.compare(): test degrees of freedom, X^2^ value, and p-value.
default
: Default method.
mira
: Method for models fit with the mice package.
lrtest_removeTerm.default, lrtest_removeTerm.mira
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ## Fit full model using iris data
fullModel <- lm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width, data = iris)
## What about just the effect of Petal.Length?
lrtest_removeTerm(fullModel, 'Petal.Length')
## What about the effect of both Petal variables?
lrtest_removeTerm(fullModel, 'Petal.Length + Petal.Width')
## Add missingness to iris data
iris_missing <- iris
iris_missing[sample(1:nrow(iris), size = round(nrow(iris_missing) / 10)), 'Sepal.Width'] <- NA
## Create mice object
iris_mice <- mice(iris_missing)
#' ## Fit full model using iris data
fullModel <- with(iris_mice, lm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width))
## What about just the effect of Petal.Length?
lrtest_removeTerm(fullModel, 'Petal.Length', 'iris_mice')
## What about the effect of both Petal variables?
lrtest_removeTerm(fullModel, 'Petal.Length + Petal.Width', 'iris_mice')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.