[R] The naPattern agrument of gnls()

Ben Rich richmcb at gmail.com
Tue Aug 16 16:21:57 CEST 2005


I was hoping someone could help me to better understand the naPattern
argument in the function gnls().  Unfortunately, there's no example
using this argument provided in the help file.

According to the gnls() help file, naPattern is "an expression or
formula object, specifying which returned values are to be regarded as
missing".  As I understand it, the idea is that with some models (e.g.
quinModel) some of the rows that are needed to compute the predicted
values aren't observations of the response variable and need to be
left out of the optimization.

The nlme() function has an argument with the same name and
description.  I've used naPattern successfully with the nlme()
function, following an example in the book "Mixed-Effects Models in S
and S-PLUS" by Pinheiro and Bates, but a similar attempt with gnls()
fails with the error message:

  Error in data.frame(data, getParsGnls(plist, pmap, beta, N)) :
        arguments imply differing number of rows: 695, 287

Any help or explanation would be appreciated.
I'm using R version 2.1.0 on linux.




More information about the R-help mailing list