[R-sig-ME] deriv example for nlmer
ONKELINX, Thierry
Thierry.ONKELINX at inbo.be
Tue Oct 19 10:09:33 CEST 2010
Dear Helen,
Won't it be easier to stick with Sslogis to run the model and then
convert scal to K for your report?
HTH,
Thierry
------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
Research Institute for Nature and Forest
team Biometrics & Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data.
~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
> -----Oorspronkelijk bericht-----
> Van: r-sig-mixed-models-bounces at r-project.org
> [mailto:r-sig-mixed-models-bounces at r-project.org] Namens Helen Sofaer
> Verzonden: dinsdag 19 oktober 2010 4:07
> Aan: r-sig-mixed-models at r-project.org
> Onderwerp: [R-sig-ME] deriv example for nlmer
>
>
> Hello modelers,
> I am working on a growth rate analysis in lme4, where my goal
> is to test for differences in growth rates between two
> populations of birds while incorporating random effects for
> nests (to deal with the lack of independence between
> siblings) and for each nestling (to deal with repeated
> measures of individuals).
>
> I'd like to build a model that is parameterized slightly
> differently than the SSlogis self-starting model, where K =
> 1/scal (this is simply due to convention in the bird world).
> I can tweak the SSlogis code (given in the help file for
> selfStart) and the model runs, but cannot test for
> differences between populations. Since determining reasonable
> starting values is not a problem, and I'd like to be able to
> easily adjust the formula to incorporate additional
> covariates, I would like to avoid using a self-starting function.
>
> It is my understanding that nlmer requires a function, but
> not necessarily a self-starting one. However, I can't find an
> example of any code that does this.
>
> I can build a very simple function that allows for
> differences between populations (referred to as site, which
> is a 0 1 dummy variable) in both the inflection point (xmid)
> and the growth rate (K). I'm trying to start with the
> simplest reasonable model, so I didn't allow for differences
> in the asymptote. This function works in nls:
>
> logisKsite = function(Age, site, Asym, xmid, K, Kdiff, middiff){
> Asym/(1 + exp((xmid+middiff*site - Age)*(K+Kdiff*site)))
> }
>
> startsite = c(Asym = 9, xmid = 3, K = .5, Kdiff=0, middiff=0)
> nls_logisKsite = nls(weight ~ logisKsite(Age, site, Asym,
> xmid, K, Kdiff, middiff), growth, start = startsite)
>
> The nlmer model I am trying to run is (for simplicity, this
> model includes only a random effect of nest, only on the K parameter):
> nlmer_logisKsite = nlmer(weight ~ logisKsite(Age, site, Asym,
> xmid, K, Kdiff, middiff) ~ (K | Nest_ID), growth, start =
> startsite, verbose = TRUE)
>
> Running this model in nlmer produces the error: gradient
> attribute of evaluated model must be a numeric matrix Dr.
> Bates' posted lectures note that the model must provide
> derivatives, via the deriv function. I haven't been
> successful getting this to work, even in the model without
> site effects.
>
> If there is an example of how to run nlmer without a
> self-start function, could someone please point me to it?
> Advise on how to implement the deriv function would also be
> very helpful.
>
> Thank you very much,
>
> Helen
>
> Helen Sofaer, PhD Candidate in Ecology, Colorado State University
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
More information about the R-sig-mixed-models
mailing list