I am trying to estimate models with subsets using the NLME package. However, I am getting an error in the case below (among others):> subset <- c(rep(TRUE, 107), FALSE) > fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1, subset=subset)Error in xj[i] : invalid subscript type 'closure'> fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1, subset=1:107)The second estimation works. Does anyone know if there is another work-around? (I have also e-mailed the package maintainers, but one of the e-mails bounced, so I am trying this list as well.) Thank you! Rebecca -- Rebecca Sela IOMS/Statistics Group Stern School of Business New York University
On Jun 25, 2009, at 11:35 AM, Rebecca Sela wrote:> I am trying to estimate models with subsets using the NLME package. > However, I am getting an error in the case below (among others): >> subset <- c(rep(TRUE, 107), FALSE) >> fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1, >> subset=subset) > Error in xj[i] : invalid subscript type 'closure' >> fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1, >> subset=1:107) > > The second estimation works. > > Does anyone know if there is another work-around? (I have also e- > mailed the package maintainers, but one of the e-mails bounced, so I > am trying this list as well.)Hard to tell. Closure is a type of function. It appears that R might be mistaking its own function "subset" for the object that you intended to pass. Perhaps if you stopped calling your dogs, "Dog"? > library(fortunes) > fortune("dog")> Thank you! > > Rebecca > > -- > Rebecca Sela > IOMS/Statistics Group > Stern School of Business > New York University > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius, MD Heritage Laboratories West Hartford, CT
Rebecca, I think the problem is that subset is a nume of an R function. If you do something like subs <- c(rep(TRUE, 107), FALSE) fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1, subset=subs) everything works fine. Hope this helps, Andy __________________________________ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory ----- E-mail: apjaworski@mmm.com Tel: (651) 733-6092 Fax: (651) 736-3122 Rebecca Sela <rsela@stern.nyu.edu> Sent by: r-help-bounces@r-project.org 06/25/2009 10:37 AM To r-help <r-help@r-project.org> cc Subject [R] Problems with subsets in NLME I am trying to estimate models with subsets using the NLME package. However, I am getting an error in the case below (among others):> subset <- c(rep(TRUE, 107), FALSE) > fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1,subset=subset) Error in xj[i] : invalid subscript type 'closure'> fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1,subset=1:107) The second estimation works. Does anyone know if there is another work-around? (I have also e-mailed the package maintainers, but one of the e-mails bounced, so I am trying this list as well.) Thank you! Rebecca -- Rebecca Sela IOMS/Statistics Group Stern School of Business New York University ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]