On 2/16/2007 12:57 PM, Tom La Bone wrote:> I suspect that the line in the added variable plot (library car) is a SLR
of
> the residuals, but I can't seem to find this written anywhere. Can
someone
> confirm this? Thanks.
You can look at the source:
> av.plot
function (model, ...)
{
UseMethod("av.plot")
}
<environment: namespace:car>
So the answer will depend on what kind of model you want. The method
for lm objects would be in av.plot.lm, which is not directly visible:
> av.plot.lm
Error: object "av.plot.lm" not found
however getAnywhere finds it:
> getAnywhere("av.plot.lm")
A single object matching 'av.plot.lm' was found
It was found in the following places
registered S3 method for av.plot from namespace car
namespace:car
with value
function (model, variable, labels =
names(residuals(model)[!is.na(residuals(model))]),
identify.points = TRUE, las = par("las"), col = palette()[2],
pch = 1, lwd = 2, main = "Added-Variable Plot", ...)
{
variable <- if (is.character(variable) & 1 == length(variable))
variable
else deparse(substitute(variable))
mod.mat <- model.matrix(model)
var.names <- colnames(mod.mat)
var <- which(variable == var.names)
if (0 == length(var))
stop(paste(variable, "is not a column of the model matrix."))
response <- response(model)
responseName <- responseName(model)
if (is.null(weights(model)))
wt <- rep(1, length(response))
else wt <- weights(model)
res <- lsfit(mod.mat[, -var], cbind(mod.mat[, var], response),
wt = wt, intercept = FALSE)$residuals
plot(res[, 1], res[, 2], xlab = paste(var.names[var], "|
others"),
ylab = paste(responseName, " | others"), main = main,
las = las, col = col, pch = pch)
abline(lsfit(res[, 1], res[, 2], wt = wt), col = col, lwd = lwd)
if (identify.points)
identify(res[, 1], res[, 2], labels)
}
<environment: namespace:car>
>
from which I would conclude that your description is correct: the line
is drawn in the abline() call near the bottom.
Duncan Murdoch