anova.uRegress {rigr} | R Documentation |
ANOVA
Description
Compute analysis of variance (or deviance) tables for two fitted, nested uRegress
objects. The model with more
parameters is referred to as the full model (or the larger model), and the model with fewer
parameters is referred to as the null model (or the smaller model).
Usage
## S3 method for class 'uRegress'
anova(object, full_object, test = "LRT", robustSE = TRUE, useFdstn = TRUE, ...)
Arguments
object |
an object of class |
full_object |
an object of class |
test |
a character string specifying the test statistic to be used. Can be one of |
robustSE |
a logical value indicating whether or not to use robust
standard errors in calculation. Defaults to |
useFdstn |
a logical indicator that the F distribution should be used for test statistics
instead of the chi squared distribution. Defaults to |
... |
argument to be passed in |
Value
A list of class anova.uRegress
with the following components:
printMat |
A formatted table with inferential results (i.e., test statistics and p-values) for comparing two nested models. |
null model |
The null model in the comparison. |
full model |
The full model in the comparison. |
Examples
# Loading required libraries
library(sandwich)
# Reading in a dataset
data(mri)
# Linear regression of LDL on age and stroke (with robust SE by default)
testReg_null <- regress ("mean", ldl~age+stroke, data = mri)
# Linear regression of LDL on age, stroke, and race (with robust SE by default)
testReg_full <- regress ("mean", ldl~age+stroke+race, data = mri)
# Comparing the two models using the Wald test with robust SE
anova(testReg_null, testReg_full, test = "Wald")