[R] Can't understand error message :-{
John Logsdon
j.logsdon at lancaster.ac.uk
Thu Mar 4 20:53:06 CET 1999
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.
Another consequence of the present inconsistency is that, it *is* possible
that the vector contraction just happens to return a vector of the same
length. This happened to me without realising it for a time - I had 625
items and took a subset of 620 but, through ignorance of the correct
commands and a good measure of stupidity, it was the wrong subset!
Fortunately I checked and from the plots it was obvious that something was
wrong but it makes me rather nervous when handling big data sets. Mea
culpa I know but it is an easy trap to fall into.
Where there are lots of NA's and lots of subsets of data, I also find
myself making too many similar copies of data to avoid very long plot()
commands then forgetting which is which. Another case for an extended
form of ls() (ls-l maybe) as recently suggested which includes the
structure size and perhaps class etc.
John
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list