[R-sig-ME] Gastric emptying data: nlmer vs. nlme
Dieter Menne
dieter.menne at menne-biomed.de
Fri Oct 5 08:28:11 CEST 2007
Douglas,
thanks a lot for your explanations.
> The reason that the first model is so difficult to fit is because
> there are 6 variance-covariance parameters and only 8 levels of
> subj:treat. You are trying to estimate too many variance-covariance
> parameters from too few groups. The likelihood surface will be very
> flat and the parameter estimates will be ill-defined.
I realized that the demo example was badly stripped down, but as you
noted it was the idea to compare nlmer and nlme.
>>>This means that the function value being optimized is not
>> reproducible and that causes a lot of problems in a
>> derivative-free optimization.
Here I am confused. I first had explicitly added the gradient, until I realized
that for this simple function selfStart() had produced it automatically. Or did
I misunderstand "derivative-free"?
Dieter
----
EmptInit= function(mCall,LHS,data){ # dummy, not explicitly used
stop("Should not be called")
}
# Standard LinExp model for gastric emptying
SSEmptLinExp=selfStart(~v0*(1+kappa*t/tempt)*exp(-t/tempt),
initial=EmptInit, parameters= c("v0","kappa","tempt"))
SSEmptLinExp
----
function (t, v0, kappa, tempt)
{
.expr1 <- kappa * t
.expr3 <- 1 + .expr1/tempt
.expr4 <- v0 * .expr3
.expr7 <- exp(-t/tempt)
.expr13 <- tempt^2
.value <- .expr4 * .expr7
.grad <- array(0, c(length(.value), 3L), list(NULL, c("v0",
"kappa", "tempt")))
.grad[, "v0"] <- .expr3 * .expr7
.grad[, "kappa"] <- v0 * (t/tempt) * .expr7
.grad[, "tempt"] <- .expr4 * (.expr7 * (t/.expr13)) - v0 *
(.expr1/.expr13) * .expr7
attr(.value, "gradient") <- .grad
.value
}
<environment: 0x0383825c>
attr(,"initial")
function(mCall,LHS,data){ # dummy, not explicitly used
stop("Should not be called")
}
attr(,"pnames")
[1] "v0" "kappa" "tempt"
attr(,"class")
[1] "selfStart"
>
More information about the R-sig-mixed-models
mailing list