Hi there, I am using SAS Proc NLMIXED to maximize a likelihood with multivariate normal random effects. An example is the two part random effects model for repeated measures semi-continous data with a cluster at 0. I use the "model y ~ general(loglike)" statement in Proc NLMIXED, so I can specify a general log likelihood function constructed by SAS programming statements. Then the likelihood can be maximized by AGQ. Is there a similar generic AGQ function in R to let me write explicitly the log likelihood and then maximize it accordingly? Can nlme do the work? Thanks! Lei Liu Assistant Professor Division of Biostatistics and Epidemiology Department of Public Health Sciences School of Medicine University of Virginia 3181 Hospital West Complex Charlottesville, VA 22908-0717 1-434-982-3364 (o) 1-434-806-8086 (c) 1-434-243-5787 (f) liulei at virginia.edu ll9f at virginia.edu
Spencer Graves
2006-Sep-02 07:44 UTC
[R] a generic Adaptive Gauss Quadrature function in R?
I'm not aware of any generic Adaptive Gaussian Quadrature (AGQ) function currently available in R, similar to what you describe. Certainly, 'nlme' can NOT do this. The lmer{lme4 / Matrix} and glmmML{glmmML} packages both have specialized versions of this embedded in their code but not extracted as a separate function, as far as I know. I agree it would be nice to have such. However, I see two problems with it. First, we want to center the approximating Gaussian at some place close to the maximum of the integrand over its variables of integration given its parameters. One problem is that the quadrature points is a function of this maximum, and the maximum is a function of the parameters. Thus, we throw away potentially relatively expensive function evaluations each time we change the center and scaling of the approximating Gaussian. With a genuinely multidimensional integral, this can become computationally quite expensive. Second and often more important, AGQ will only perform well if the ratio of the integrand to a normal density is adequately approximated by a polynomial. If that's not the case, we do NOT get the accuracy apparently promised by the Gaussian quadrature theorems. I've tried to use AGQ for this type of problem and ultimately abandoned it because I was not getting the accuracy I needed. Besides this, any kind of adaptive integration is easier with nested than crossed factors. I've wanted to explore the possibilities of spline integration to overcome both these problems, but I haven't had time to work on that. This is not the answer you wanted, but I hope it helps. Spencer Graves Lei Liu wrote:> Hi there, > > I am using SAS Proc NLMIXED to maximize a likelihood with > multivariate normal random effects. An example is the two part random > effects model for repeated measures semi-continous data with a > cluster at 0. I use the "model y ~ general(loglike)" statement in > Proc NLMIXED, so I can specify a general log likelihood function > constructed by SAS programming statements. Then the likelihood can be > maximized by AGQ. Is there a similar generic AGQ function in R to let > me write explicitly the log likelihood and then maximize it > accordingly? Can nlme do the work? Thanks! > > Lei Liu > Assistant Professor > Division of Biostatistics and Epidemiology > Department of Public Health Sciences > School of Medicine > University of Virginia > > 3181 Hospital West Complex > Charlottesville, VA 22908-0717 > > 1-434-982-3364 (o) > 1-434-806-8086 (c) > 1-434-243-5787 (f) > > liulei at virginia.edu > ll9f at virginia.edu > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >