[R-sig-ME] nlme and missing data...

Ben Bolker bbolker at gmail.com
Fri Feb 18 16:33:04 CET 2011


  [cc'ing back to r-sig-ME]

On 11-02-18 10:28 AM, Jeffrey Harring wrote:
> Ben,
> 
> I take it then that nlme ( ) does not process data with NA for a
> repeated measure. Is this what you're saying? I read the na.omit as a
> operation that deletes an entire case worth of data if for that case a
> NA value is found. Is my thinking right here?

  Correct.

  However, because nlme (and most R packages) handle repeated measures
data in long format, this might not be as much of a problem as you
think.  If you are used to data in wide format such as

subject   obs1  obs2  obs3  obs4
 1          1    2      3     NA
 2          2    2      3     4

  you would be rightly concerned that the missing value for individual 1
at time 4 would wipe out all the data for subject 1.  However, nlme
wants the data in the format:

subject  obs  value
  1       1    1
  1       2    2
  1       3    3
  1       4    NA
  2       1    2
  2       2    2
  2       3    3
  2       4    4

in which case dropping the NA case doesn't actually lose any information.

>  
> Thanks for your time.
> Jeff
> 
> On 2/18/2011 10:13 AM, Ben Bolker wrote:
>> On 11-02-18 10:05 AM, Jeffrey Harring wrote:
>>> Can anyone tell me if nlme ( ) accepts missing data?
>>>
>>> The default argument to handle missingness for nlme ( ) is
>>>
>>> na.action = na.fail
>>>
>>> Is there another specification to allow some missing data or a work
>>> around to coerce nlme ( ) to accept data which are missing?
>>>
>>> Any help at all would be greatly appreciated.
>>>
>>> Thanks,
>>> Jeff
>>>
>>    What do you want nlme to do with cases with missing data?  (This is a
>> real question.)  As the other poster said you can you na.action=na.omit,
>> or you can just use na.omit() up front (i.e. as far as I know
>>
>>    nlme(...,data=na.omit(mydata))
>>
>> and
>>
>>    nlme(...,data=mydata,na.action=na.omit)
>>
>>   should be more or less equivalent.
>>
>>    Ben Bolker
>




More information about the R-sig-mixed-models mailing list