Influence Measures and Diagnostic Plots for Multivariate Linear Models
Version 0.9.3
Functions in this package compute regression deletion diagnostics for multivariate linear models following methods proposed by Barrett & Ling (1992) and provide some associated diagnostic plots. The diagnostic measures include hat-values (leverages), generalized Cook’s distance, and generalized squared ‘studentized’ residuals. Several types of plots to detect influential observations are provided.
In addition, the functions provide diagnostics for deletion of subsets
of observations of size m>1. This case is theoretically interesting
because sometimes pairs (m=2) of influential observations can mask
each other, sometimes they can have joint influence far exceeding their
individual effects, as well as other interesting phenomena described by
Lawrence (1995). Associated methods for the case m>1 are still under
development in this package.
Documentation
Documentation for the package is now available at https://friendly.github.io/mvinfluence/.
Installation
Get the released CRAN version or the development version, here or R-universe
| CRAN version | install.packages("mvinfluence") |
| R-universe | install.packages("mvinfluence", repos = c('https://friendly.r-universe.dev') |
| Development version | remotes::install_github("friendly/mvinfluence") |
Goals
The design goal for this package is that, as an extension of standard methods for univariate linear models, you should be able to fit a linear model with a multivariate response,
mymlm <- lm( cbind(y1, y2, y3) ~ x1 + x2 + x3, data=mydata)
and then get useful diagnostics and plots with:
influence(mymlm)
hatvalues(mymlm)
cooks.distance(mymlm)
influencePlot(mymlm, ...)
As is done in comparable univariate functions in the car package,
noteworthy points are identified in printed output and graphs.
Examples
The Rohwer data contains data on kindergarten children designed to
examine how well performance on a set of paired-associate (PA) learning
tasks can predict performance on some measures of aptitude and
achievement— SAT (a scholastic aptitude test), PPVT (Peabody Picture
Vocabulary Test), and Raven ( Raven Progressive Matrices Test). The PA
tasks differ in how the stimulus item was presented: n (named), s
(still), ns (named still), na (named action) and ss (sentence
still).
Here, we fit a MLM to a subset of the Rohwer data (the Low SES group).
data(Rohwer, package="heplots") Rohwer2 <- subset(Rohwer, subset=group==2) rownames(Rohwer2)<- 1:nrow(Rohwer2) Rohwer.mod <- lm(cbind(SAT, PPVT, Raven) ~ n + s + ns + na + ss, data=Rohwer2) car::Anova(Rohwer.mod) #> #> Type II MANOVA Tests: Pillai test statistic #> Df test stat approx F num Df den Df Pr(>F) #> n 1 0.202 2.02 3 24 0.1376 #> s 1 0.310 3.59 3 24 0.0284 * #> ns 1 0.358 4.46 3 24 0.0126 * #> na 1 0.465 6.96 3 24 0.0016 ** #> ss 1 0.089 0.78 3 24 0.5173 #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Influence plots
The default influence plot (type="stres") shows the squared
standardized residual against the Hat value. The areas of the circles
representing the observations are proportional to generalized Cook’s
distances.
(infl <-influencePlot(Rohwer.mod, id.n=4, type = "stres"))
#> H Q CookD L R
#> 5 0.568 0.3439 0.8467 1.316 0.7964
#> 10 0.452 0.0324 0.0634 0.824 0.0591
#> 14 0.126 0.2997 0.1643 0.145 0.3431
#> 15 0.332 0.0105 0.0152 0.498 0.0158
#> 25 0.157 0.3820 0.2601 0.186 0.4532
#> 27 0.367 0.2128 0.3387 0.580 0.3363
#> 29 0.304 0.2295 0.3026 0.437 0.3299
As you can see above, the function returns a data frame of the influence
statistics for the identified points. “Noteworthy” points are those that
are unusual on either Hat value (H) or the squared studentized
residual (Q), so more points will be shown than the id.n value. It is
often more useful to sort these in descending order by one of the
influence measures.
infl |> dplyr::arrange(desc(H)) #> H Q CookD L R #> 5 0.568 0.3439 0.8467 1.316 0.7964 #> 10 0.452 0.0324 0.0634 0.824 0.0591 #> 27 0.367 0.2128 0.3387 0.580 0.3363 #> 15 0.332 0.0105 0.0152 0.498 0.0158 #> 29 0.304 0.2295 0.3026 0.437 0.3299 #> 25 0.157 0.3820 0.2601 0.186 0.4532 #> 14 0.126 0.2997 0.1643 0.145 0.3431
An alternative (type="LR") plots residual components against leverage
components, both on log scales. Because influence is a product of
residual
