# Re: [S] Adjusted variables plots

Sat, 7 Mar 1998 11:44:02 +1030

> I want to look for high-influence observations in my dataset.
> The Cook's distance is useful, but I'm interested in looking
> at influentials separately for each coefficient of a
> multivariate regression. I've used adjusted-variables plots
> (I think they are also called partial-regression plots) in the
> past to find outliers and leverage points. So for the k-th
> coefficient coefficient Beta sub-k, I would plot residuals of
> the regression of outcome Y on all predictors X except the
> k-th, versus residuals of the regression of the k-th X on all
> X's except the k-th.
>
> Before I try to write a function to speed up this type of
> diagnostic analysis, I'm wondering is such a function exists?
> Or can predict() be used to this end? I've found nothing in
> the SPlus v. 4.0 documentation. Should I be looking in
> libraries contributed by others?

I'm not aware of explicit functions to do the job, but there are
some little tricks that make it pretty simple from the command
line interface. Suppose you fit a regression of the form

> fm <- lm(y ~ x1 + x2 + x3 + x4 + x5 + x6, data = dat)

and you want the partial residual plot of y on x5 to check for
curvature, let's say. You can do the plot in one step as

> plot(resid(update(fm, cbind(x5, y) ~ . - x5)),
xlab = "Adjusted X5", ylab = "Partial Y residuals")

The second line is not needed if you don't mind obscure axis
labels.

Stepping through all x-variables might be a bit tricky to do in a
general function if you wanted to allow for factor terms, for
example, but something sensible could be done, I suppose.

Bill Venables.

```--
Bill Venables, Head, Dept of Statistics,    Tel.: +61 8 8303 5418
University of Adelaide,                     Fax.: +61 8 8303 3696