# [R] lme() with known level-one variances

Setzer.Woodrow@epamail.epa.gov Setzer.Woodrow at epamail.epa.gov
Fri Aug 30 18:28:18 CEST 2002

```Right.  After thinking about the problem a few minutes longer, I
realized my mistake.  Chapter 5 ("Inference Based on Individual
Estimates") of Davidian and Giltinan (1995) : "Nonlinear Models for
Repeated Measurement Data" can be used to do exactly this.  It turns out
to be quite simple for a one-dimensional parameter, and I coded it up.
This is my interpretation of their "Global two-stage method":

"estmixed" <-
function (mi, sei)
{
if (length(mi) == 1) {
c(muhat = mi, muhat.se = sei, sdhat = NA)
}
else {
vari <- sei^2
start <- c(mean(mi), log(var(mi)))
out <- try(optim(par = start, fn = mll, method = "BFGS",
mi = mi, vari = vari))
if (inherits(out, "try-error")) {
print(cbind(mi, sei))
print(out)
stop("Problem in optim")
}
if (out\$convergence == 0)
c(muhat = out\$par[1], muhat.se = sqrt(1/sum(1/(vari +
exp(out\$par[2])))), sdhat = sqrt(exp(out\$par[2])))
else c(muhat = NA, muhat.se = NA, sdhat = NA)
}
}

On input, mi is the vector of parameter estimates, and sei is the vector of their standard errors.
On output, muhat is the global estimate, muhat.se is an estimate of its standard error, and sdhat is an estimate of the among-group standard
deviation.

R. Woodrow Setzer, Jr.                                            Phone:
(919) 541-0128
Experimental Toxicology Division                       Fax:  (919)
541-5394
Pharmacokinetics Branch
NHEERL MD-74; US EPA; RTP, NC 27711

Thomas Lumley
<tlumley at u.washin        To:       Woodrow Setzer/RTP/USEPA/US at EPA
gton.edu>                cc:       "J.R. Lockwood" <lockwood at rand.org>, r-help at stat.math.ethz.ch
Subject:  Re: [R] lme() with known level-one variances
08/30/02 12:11 PM

On Fri, 30 Aug 2002 Setzer.Woodrow at epamail.epa.gov wrote:

>
> If I understand your request correctly, you want to use something like
> "weights=varIdent(...)" as an argument to lme().  varIdent and the
other
> varFunc constructors have an argument "fixed" that allow you to
specify
> values for some or all of the coefficients of the variance function.
> See ?varIdent.  The actual error variance will be varFunc() * sigma^2,
> where sigma^2 is estimated.
>

That's the problem.

As happens in meta-analysis as well, the problem is to estimate a model
with a variance component fixed. Not fixed up to a scale parameter.
Fixed.

In meta-analysis the model is that within each trial a treatment effect
parameter is constant, and as the trial is large the variance of the
estimated treatment effect is very accurately known conditional on the
true treatment effect for that trial. The unconditional variance is then
the known conditional variance plus an unknown variance.

It doesn't seem that lme() is designed for this, and last time I tried
to
do it I gave up and changed the model more or less as you suggest.

-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```