John Logsdon <j.logsdon at lancaster.ac.uk> writes:
On 2 Mar 1999, Peter Dalgaard BSA wrote:
(1) Missing values in response and/or regressors cause cases to be
discarded.
(2) Plotting which of the y's against which x's ?
plot(mschmod$residuals ~ size94[complete.cases(mavgres,crimesch,
socstat,povnojob,ploinc94,aa94,hisp94,minty94,mixed94)])
should do the trick. Or, simpler but sneakier:
attach(sizef[rownames(mschmod$model),])
plot(residuals(mschmod) ~ size94)
detach()
It should also work with:
evalq(plot(residuals(mschmod) ~ size94), sizef[rownames(mschmod$model),])
(none of the above is tested, since I don't have your data of course)
The problems of plotting residuals vs fitted data/covariates where there
are NAs caught me out a little while ago. Would it not be better if the
fitting functions lm, glm etc and plot were consistent? Thus either (a)
plot() omitted cases in the X or the Y which were NA before checking for
length consistency or (b) residuals() etc included NA in the appropriate
places.
(a) won't work if you think closer about it. (b) might. I wouldn't be
surprised if there's a rationale for the way things are now, but I
can't seem to reconstruct it. Well, there's space saving of course,
but given the waste in other areas, that is hardly a crucial point.
Possibly, consistent behaviour of drop(), etc. has something to do
with it.