[R] how calculation degrees freedom

Douglas Bates dmbates at gmail.com
Tue Jan 31 18:52:55 CET 2006


On 1/29/06, Søren Højsgaard <Soren.Hojsgaard at agrsci.dk> wrote:
> In connection with calculating Monte Carlo p-values based on sampled data sets: The calculations involve something like
>    update(lmer.model, data=newdata)
> where newdata is a simulated dataset comming from simulate(lmer.model). I guess the update could be faster if one could supply the update function with the parameter estimates from the original fit of the lmer.model as starting values. Is this possible to achieve??

Possible - yes.  (See the quote in the fortunes package about "This is
R.  There is no if - only how.")

Roughly what one does is

 - Take a copy of the fitted model object as, say, "mer"
 - .Call("mer_update_y", mer, ynew, PACKAGE = "Matrix")
 - arrange for a suitable call to
   LMEoptimize(mer) <- controloptions

The last part is a little tricky in that "LMEoptimize<-" is hidden in
the Matrix namespace.

I'm happy to write a function to do this but my creativity is at a low
ebb and I would appreciate any suggestions for a suitable name and
calling sequence.  Even more welcome would be an existing generic
function for which something like this could be a method.

> Best
> Søren
>
> ________________________________
>
> Fra: pd at pubhealth.ku.dk på vegne af Peter Dalgaard
> Sendt: lø 28-01-2006 01:12
> Til: Douglas Bates
> Cc: Søren Højsgaard; R-help at stat.math.ethz.ch
> Emne: Re: [R] how calculation degrees freedom
>
>
>
> Douglas Bates <dmbates at gmail.com> writes:
>
>
> > > Of course, Monte Carlo p-values have their problems, but the world
> > > is not perfect....
> >
> > Another approach is to use mcmcsamp to derive a sample from the
> > posterior distribution of the parameters using Markov Chain Monte
> > Carlo sampling.  If you are interested in intervals rather than
> > p-values the HPDinterval function from the coda package can create
> > those.
> >
>
> We (Søren and I) actually had a look at that, and it seems not to
> solve the problem. Rather, mcmcsamp tends to reproduce the Wald style
> inference (infinite DF) if you use a suitably vague prior.
>
> It's a bit hard to understand clearly, but I think the crux is that
> any Bayes inference only depends on data through the likelihood
> function. The distribution of the likelihood never enters (the
> hardcore Bayesian of course won't care). However, the nature of DF
> corrections is that the LRT does not have its asymptotic distribution,
> and mcmc has no way of picking that up.
>
>
> --
>    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>  (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907
>
>
>
>




More information about the R-help mailing list