Although having Doug comment directly would be better, I think it's fair to say on the basis of his many previous posts on exactly this issue that it's actually a bit more problematic than Greg may have indicated. It's not that the code has not yet been written -- it's that Doug Bates, who knows as much as about this as anyone, I believe -- does not yet know **how** to write the code. That is, his research has shown that the standard approximations (e.g. to the distribution of likelihood ratios)are generally not good enough to be relied upon, and he has not yet settled on good alternatives.
As you pointed out in your original post -- and as Doug has also pointed out -- mcmcsamp can be problematic, especially in the general -mer case. So I think Greg's point 6) below is particularly apropos. The value of statistical inference -- and hypothesis testing in particular -- is overstated, especially in the exploratory settings that dominate scientific work (clinical trials are a prominent exception to this pronouncement!). But this is my opinion only,and **not** necessarily that of Doug Bates or anyone else. Feel free to disregard it. Cheers, Bert Bert Gunter Genentech, Inc. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Wilson, Mark Sent: Friday, August 29, 2008 9:07 AM To: Greg Snow; r-help@r-project.org Subject: Re: [R] significance of random effects in poisson lmer Thanks very much Greg, Actually, that was every bit as helpful as I had hoped for, possibly even a little more so! The response was very quick, for which I am grateful, and not only did I understand it, but it also succeeded in reassuring me that I had't just grasped the wrong end of the stick. I am greatly heartened by the fact that my explanation of what I was trying to do made sense to you. Marvelous resource that it is, R can be intimidating to beginners, and as someone just learning how to use mixed models I frequently feel as if I am way in over my head. I had more or less settled on option 6 as an intermediate solution while I waited to see if there was anything more comprehensive I could do. I think I can live without knowing more about the effect that Site and Cluster have on bird species richness. I just have to hope the reviewers of my paper will be able to. I also agree with you that Doug Bates and others who have built (and are continuing to build) the statistical infrastructure within R, which has revolutionized the way that thousands of people do and think about statistics, are doing a fantastic job. If I had the funds, I'd give serious consideration to option 3 below. As it is, I look forward to struggling to keep up with their achievements! Best wishes, Mark -----Original Message----- From: Greg Snow [mailto:[EMAIL PROTECTED] Sent: 29 August 2008 16:27 To: Wilson, Mark; r-help@r-project.org Subject: RE: significance of random effects in poisson lmer The key line in the error message is: "Update not yet written". The lme4 package and functions in it are a work in progress, Dr. Bates is doing a great job on getting parts done and is making the parts that are done available for people to use, test, and comment on, but he only has so much time. He has some functions in place as place holders to show what will happen some day, but the function you want (for the type of analysis you want) is one of those that has not been written yet. What can you do? Here are a couple of suggestions: 1. be patient and wait for this code to be written (I think it is still down the list a ways, so this will not be a short wait). 2. Write the code yourself and submit it for inclusion. 3. Give Dr. Bates a huge sum of Money so that he can spend more time working on writing the function(s) you need/want. 4. See if another existing tool will do what you want (there are some other tools in R that address specific types of glmms, one may fit your situation, or you could switch to a Bayesian Hierarchical model). 5. Find a way to distort the space-time continuum so that Dr. Bates can program thousands of hours while the rest of us experience only a few minutes. 6. Ask yourself if you really need to test the significance of the random effects or can you just go with the estimate of them and focus on answering other questions. 7. Invent a time machine, go forward in time and get the completed code and bring it back (or it may be easier to create a time machine that can only send data through time and use it to download the lme4 package from a future CRAN). 8. Explore your data and the theory behind it to decide if the normal approximation to the poisson is good enough to answer your question, and if it is, then use the normal approximation (that part is working). There may be others, This probably is not as helpful as you hoped, but hopefully at least will stop you from trying things that won't work for a while. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Wilson, Mark > Sent: Friday, August 29, 2008 5:23 AM > To: r-help@r-project.org > Subject: [R] significance of random effects in poisson lmer > > Hi, > > I am having problems trying to assess the significance of > random terms in a generalized linear mixed model using lme4 > package. The model describes bird species richness R along > roads (offset by log length of road log_length) as a function > of fixed effects Shrub (%shrub cover) and Width (width of > road), and random effect Site (nested within Site Cluster). > > >From reading answers to previous posts, it seems that the > consensus is > to derive p-values using the neat little piece of code posted > by Doug Bates as "mcmcpvalue". This code calls the merMCMC > object created by the function mcmcsamp, but I can't even get > as far as using this function without running into > difficulty. Basically, I get an error message saying "Error > in .local(object, n, verbose, ...) : Update not yet written" > - see below for complete code. > > Does anyone know why I am getting this error message and what > if anything I can do to address the problem? I am aware that > p-values derived via MCMC in this way can problematic when > used with models that incorporate offsets. However, I get the > same error message if I take the offset out of the model. The > only way I can get mcmcsamp to run is to leave out the > specification of the model as poisson. However, I'm pretty > sure I don't want to do this. > > Provided someone can tell me what I'm doing wrong, and I am > able to generate my MCMC sample, are there any work-arounds > the problems people have encountered using mcmcpvalue on > models with offsets? Could I control for the effect of road > length on bird species richness by using residuals from the > relationship between the R and log_length as my response > variable? If not, then how can one estimate the significance > values of random effects of lmer models with offsets? > > Very grateful for any suggestions, > > Mark > > > > > model<-lmer(R~Shrub+width+(1|Cluster/Site)+offset(log_length), > family=poi > sson) > > summary(model) > Generalized linear mixed model fit by the Laplace approximation > Formula: R ~ Shrub + width + (1 | Cluster/Site) + offset(log_length) > AIC BIC logLik deviance > 59.76 70.56 -24.88 49.76 > Random effects: > Groups Name Variance Std.Dev. > Site:Cluster (Intercept) 2.9878e-12 1.7285e-06 > Cluster (Intercept) 0.0000e+00 0.0000e+00 > Number of obs: 64, groups: Site:Cluster, 12; Cluster, 2 > > Fixed effects: > Estimate Std. Error z value Pr(>|z|) > (Intercept) -3.908504 0.198535 -19.687 < 2e-16 *** > Shrub 0.016509 0.004355 3.791 0.000150 *** > width -0.016435 0.009779 -1.681 0.092812 . > --- > Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > > Correlation of Fixed Effects: > (Intr) Shrub > Shrub -0.040 > width -0.881 -0.322 > > samp<-mcmcsamp(model,50000) > Error in .local(object, n, verbose, ...) : Update not yet written > > > > ______________________________________________ > 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. > ______________________________________________ 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. ______________________________________________ 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.