crTest: Test of linearity for Component + Residual Plots

Description Usage Arguments Value Author(s) Examples

View source: R/DAMisc_functions.R

Description

This function estimates a linear model and a loess model on the component-plus-residual plot (i.e., a partial residual plot) for each quantitative variable in the model. The residual sums of squares for each are used to calculate an F-test for each quantitative variable.

Usage

1
crTest(model, adjust.method="none", ...)

Arguments

model

A model object of class lm

adjust.method

Adjustment method for multiple-testing procedure, using p.adjust from stats.

...

Other arguments to be passed down to the call to loess.

Value

A matrix with the following columns for each variable:

RSSp

Residual sum-of-squares for the parametric (linear) model.

RSSnp

Residual sum-of-squares for the non-parametric (loess) model.

DFnum

Numerator degrees of freedom for the F-test: tr(S)-(k+1).

DFdenom

Denominator degrees of freedom for the F-test: n-tr(S)

F

F-statistic

p

p-value, potentially adjusted for multiple comparisons.

Author(s)

Dave Armstrong (UW-Milwaukee, Department of Political Science)

Examples

1
2
3
library(car)
mod <- lm(prestige ~ income + education + women, data=Prestige)
crTest(mod)

Example output

Loading required package: car
Loading required package: carData
Loading required package: effects
lattice theme set by effectsTheme()
See ?effectsTheme for details.
Warning message:
no DISPLAY variable so Tk is not available 
             RSSp   RSSnp DFnum DFdenom     F     p
income    6033.57 4985.47 4.285  95.715 4.696 0.001
education 6033.57 5460.73 3.034  96.966 3.352 0.022
women     6033.57 5838.12 2.901  97.099 1.120 0.344

DAMisc documentation built on May 2, 2019, 4:52 p.m.