[R-sig-ME] R-sig-mixed-models Digest, Vol 25, Issue 20
David Daniel
ddaniel at nmsu.edu
Tue Jan 20 21:46:21 CET 2009
Thanks for the reply, Thierry.
I thought this initially, but when only one of the variables, YES or
NO, is excluded it works for some data sets. For example for the data
generated with set.seed(2) and dropping variable NO but retaining
variable YES, resulting in the "plotData2" data.frame, half of the YES
values in the data.frame are NA, but the plot works fine. Examining
the y-values for the plot object's panel.args in this case gives all
80 values as expected:
|> plot(lmeB, Group ~ resid(., type="p"))$panel.args[[1]]$y
| [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 1 1
|[43] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2
As opposed to when both YES and NO are both in the data set, all 80
values are NA:
|> plot(lmeA, Group ~ resid(., type="p"))$panel.args[[1]]$y
| [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
NA NA NA NA NA NA NA
|[29] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
NA NA NA NA NA NA NA
|[57] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
NA NA NA
Also, I don't believe the lme() method omits observations having NA's
for variables that are not included in the model.
Thanks,
-David
On Jan 20, 2009, at 4:00 AM, r-sig-mixed-models-request at r-project.org
wrote:
> This is probably due to the fact that either YES or NO is NA in your
> dataset and you included the na.action = na.omit argument in your
> model.
> Without that argument in the model I get the plot with points.
> My guess is that lme() omits rows only if they have at least one NA
> value in a variable that is present in the model (which neither YES
> and
> NO are). But that the plot function looks for missing values in the
> entire row. Hence YES and NO are included and thus all rows omited.
>
> HTH,
>
> Thierry
----------------------------------
David Daniel
Associate Professor
University Statistics Center
New Mexico State University
ddaniel at nmsu.edu
More information about the R-sig-mixed-models
mailing list