[R-sig-ME] Bradley Terry GLMM in R ?

Thierry Onkelinx th|erry@onke||nx @end|ng |rom |nbo@be
Mon Oct 10 10:24:29 CEST 2022


Dear Shira,

- in a formula object means remove that object from the formula. Use a
weight of -1 instead.

f(home, model = "iid")) + f(away, w = -1, copy = "home")

Best regards,

ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
thierry.onkelinx using inbo.be
Havenlaan 88 bus 73, 1000 Brussel
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
///////////////////////////////////////////////////////////////////////////////////////////

<https://www.inbo.be>


Op vr 7 okt. 2022 om 23:36 schreef Shira Mitchell <shiraqotj using gmail.com>:

> Thanks so much, Thierry ! This is great.
>
> This works except that I cannot subtract because:
> f(home, model = "iid")) - f(away, copy = "home")
>
> just drops the second term. Apologies that I'm not super familiar with
> INLA syntax yet.
>
>
>
> On Fri, Oct 7, 2022 at 10:19 AM Thierry Onkelinx <thierry.onkelinx using inbo.be>
> wrote:
>
>> Hi Shira,
>>
>> I fit such models with the INLA package (https://www.r-inla.org/). The
>> trick is to define two random effects but force their parameter estimates
>> to be identical.
>>
>> The code would contain something like f(home, model = "iid")) + f(away,
>> copy = "home"). Meaning home ~ N(0, sigma_beta_i) and home[i] = away[i]
>>
>> Best regards,
>>
>> ir. Thierry Onkelinx
>> Statisticus / Statistician
>>
>> Vlaamse Overheid / Government of Flanders
>> INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE
>> AND FOREST
>> Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
>> thierry.onkelinx using inbo.be
>> Havenlaan 88 bus 73, 1000 Brussel
>> 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
>>
>> ///////////////////////////////////////////////////////////////////////////////////////////
>>
>> <https://www.inbo.be>
>>
>>
>> Op vr 7 okt. 2022 om 15:00 schreef Shira Mitchell <shiraqotj using gmail.com>:
>>
>>> We want to fit Bradley-Terry-style GLMM models in R. We looked into:
>>>
>>>
>>> https://cran.r-project.org/web/packages/BradleyTerry2/vignettes/BradleyTerry.pdf
>>> and
>>> http://bbolker.github.io/mixedmodels-misc/glmmFAQ.html
>>>
>>> We have voter-specific variables x that influence which political message
>>> (i vs j) wins for them:
>>>
>>> logit[pr(i beats j | person with covariate x)] = lambda_i - lambda_j +
>>> (beta_i - beta_j) x
>>>
>>> We then model parameters as random effects:
>>> lambda_i ~ N(0, sigma_lambda)
>>> beta_i ~ N(0, sigma_beta)
>>>
>>> Is there a way to do this in R ? We do this in TensorFlow in Python by
>>> directly specifying design matrices with the 0,-1,1 or 0,-x,x entries.
>>> However, I do not see how to do this in R using lme4, BradleyTerry2,
>>> mgcv,
>>> etc.
>>>
>>> Thanks so much,
>>> Shira
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-mixed-models using r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>
>>

	[[alternative HTML version deleted]]



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