[R-sig-ME] nlmer and the binomial distribution.

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Sun Feb 10 20:17:21 CET 2019



On 2019-02-10 1:43 p.m., Kenneth Knoblauch wrote:
> Just a point of note, that the repeated package is on CRAN
> 
> https://cran.r-project.org/web/packages/repeated/index.html

  Cool, thanks!


> 
> and the gnm package on CRAN might be able to handle this, too,
> 
> https://cran.r-project.org/web/packages/gnm/index.html
> 
> Good luck.
> 
>> nlmer does *not* handle non-Gaussian (exponential family) models
>> (GNLMMs). I don't know of a mainstream, out-of-the-box solution for
>> frequentist fits of GNLMMs in R.
>>
>> * brms can handle nonlinear models with non-Gaussian responses
>> <https://cran.r-project.org/web/packages/brms/vignettes/brms_nonlinear.html>
>>
>> . It does Bayesian estimation only, but optimization *could* be hacked
>> if you wanted <https://github.com/paul-buerkner/brms/issues/115>
>>
>> * you could try the gnlmm function in Jim Lindsey's repeated package;
>> you'll have to install it and the rmutils package from source available
>> at <http://www.commanster.eu/rcode.html>
> 
>> * to my knowledge the TMB package would be the most
>> straightforward/modern way to fit GNLMMs in R, but you would have to
>> figure out how to write the TMB code.
>>
>> On 2019-02-10 4:50 a.m., Rolf Turner wrote:
>>>
>>> It is not clear to me from the help file whether the nlmer() function
>>> from the lme4 package can be used to fit non-linear mixed models when
>>> the response has a discrete distribution, in particular a binomial
>>> distribution. I'd like to fit a mixed binomial model in which the
>>> success probability *cannot* be expressed as "linkinv(linear predictor)"
>>> where "linkinv()" is the inverse of one of the "standard" link functions
>>> (logit, probit, or cloglog) and the linear predictor is linear in the
>>> model parameters, but has to be expressed as a more complicated
>>> non-linear function of the parameters and the predictors.
>>>
>>> If it is possible, how should the response appear in the formula? Should
>>> it be given in the form
>>>
>>> cbind(successes,failures) ~ ... ?
>>>
>>> And how should the non-linear function be structured so as to
>>> accommodate the two-column nature of the response?
>>>
>>> I *might* be able to figure all this out by experimenting, but the range
>>> of possible wrong approaches and wrong garden paths down which to lead
>>> myself kind of overwhelms me.
>>>
>>> So I thought I'd ask here and maybe save myself a bit of time. :-)
>>
>>> cheers,
>> v
>>> Rolf Turner
>>>
>>> P. S. It's quite possible that my question makes no real sense at all.
>>> If so, please feel free to tell me so, but a bit of elaboration as to
>>> why would be appreciated.
>>>
>>> R. T.
>>>
> 
>



More information about the R-sig-mixed-models mailing list