Bivariate Logistic Distribution

Welcome to the forum for R2MLwiN users. Feel free to post your question about R2MLwiN here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to R2MLwiN: Running MLwiN from within R >> http://www.bris.ac.uk/cmm/software/r2mlwin/
Post Reply
dtaylor7
Posts: 6
Joined: Tue Dec 12, 2023 5:08 pm

Bivariate Logistic Distribution

Post by dtaylor7 »

Hello,

I am attempting to model two binary responses that represent two agents' decisions on the same task. Decisions are nested within agents which are nested within centres, are influenced by several covariates, and the marginal probabilities of the two decisions are identical except for when the second agent can see the first's response. Agents only ever act within a single centre.

1) Can R2MLwiN model bivariate logistic responses? I have attempted to use c(logit(decision1,cons),logit(decision2,cons)) ~ ... with family = c("Binomial","Binomial") but have received the "invalid link function" error. I have got around this so far by joining the two response columns to make a general 'decision' column and using the 'other' decision as a categorical covariate, effectively modelling the two marginals and the odds ratio between them as described in the beginning of this article https://docs.zeligproject.org/articles/ ... logit.html. However I'm concerned that the variance will be artificially shrunk by doing this.

2) If, in some centres/in the case of disagreements, a third agent was then to use decision1, decision2 and all the other information available to make a final decision for each task, how could this be modelled? Is it possible to also model a third binary response variable?

3) How would it be possible to gain information about an agent's "rate", and how it influences the final decision? Is this inference limited to odds ratios, or can non-multiplicative relationships between the responses be modelled?

4) I am aware that one of the key assumptions of multilevel models is that the predictors are not correlated with the random effects. A popular method to treat this assumption being violated is introducing cluster-means of the predictors in question. Is this necessary when using Monte-Carlo sampling, and if so does it change how the orthogonal fixed effects (orth = 1) argument is used?

For reference, my current call resembles:

model = runMLwiN(logit(decision,cons) ~ 1 + OtherDecisionIndicator + isAgent2Indicator + (1 | Centre) + (1 | AgentID),D = "Binomial",estoptions = list(EstM = 1,xc=FALSE,mcmcOptions = list(orth = 1)), data=decisions)

All variables in the model listed are categorical. Thank you very much for your help and excellent software.
ChrisCharlton
Posts: 1354
Joined: Mon Oct 19, 2009 10:34 am

Re: Bivariate Logistic Distribution

Post by ChrisCharlton »

To answer the first question, you can model bivariate logistic models with R2MLwiN. To do this you would add the following option to your model specification "D = c("Mixed", "Binomial", "Binomial")". For an example of this in the context of a model see the last example in the MLWiN User Guide Chapter 14 replication example.

Using this syntax you can specify as many response variables as you wish, with the limitation that you can only have one type of discrete response (e.g. a mixture of Normal/Binomial responses or a mixture of Normal/Poisson responses. If you are estimating the model with MCMC then only Normal and Binomial responses are supported in multivariate models.
dtaylor7
Posts: 6
Joined: Tue Dec 12, 2023 5:08 pm

Re: Bivariate Logistic Distribution

Post by dtaylor7 »

Thanks for your reply Chris. In your reply do you mean that only the specific combination of at least one Normal and one Binomial are estimable using MCMC? Attempting to use MCMC sampling in the Chapter 14 example obtains the following error:

> (mymodel6 <- runMLwiN(c(logit(binexam), logit(binlrt)) ~ 1, D = c("Mixed", "Binomial", "Binomial"), estoptions = list(EstM = 1,sort.ignore = TRUE),
+ data = tutorial))
Invalid link function specified: logit
Error in runMLwiN(c(logit(binexam), logit(binlrt)) ~ 1, D = c("Mixed", :
ChrisCharlton
Posts: 1354
Joined: Mon Oct 19, 2009 10:34 am

Re: Bivariate Logistic Distribution

Post by ChrisCharlton »

I forgot to also mention that for MCMC multivariate models in MLwiN the only link function you can use for a binomial response is probit. This is because it fits the response as a latent variable in a multivariate normal model (see Bayesian analysis of Binary and Polychotomous Response Data). You should however be able to use any combination of Normal and Binomial (including all of one type).

For an example of running a mixed response model with MCMC see the examples in MCMC Guide Chapter 19 (Mixed Response Models and Correlated Residual)
dtaylor7
Posts: 6
Joined: Tue Dec 12, 2023 5:08 pm

Re: Bivariate Logistic Distribution

Post by dtaylor7 »

Thanks Chris, that's really helpful to know. How does one interpret the random effects coefficients in such a model? Does the interpretation vary depending on the link function?

-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
MLwiN (version: unknown or >3.06) multilevel model (Mixed)
N min mean max N_complete min_complete mean_complete max_complete
school 65 2 62.44615 198 65 2 62.44615 198
Estimation algorithm: IGLS MQL1 Elapsed time : 0.45s
Number of obs: 4059 (from total 4059) The model converged after 5 iterations.
Log likelihood: NA
Deviance statistic: NA
---------------------------------------------------------------------------------------------------
The model formula:
c(logit(binexam), logit(binlrt)) ~ 1 + (1 | school)
Level 2: school Level 1: l1id
---------------------------------------------------------------------------------------------------
The fixed part estimates:
Coef. Std. Err. z Pr(>|z|) [95% Conf. Interval]
Intercept_binexam 0.03653 0.08664 0.42 0.6734 -0.13329 0.20635
Intercept_binlrt 0.01922 0.06821 0.28 0.7781 -0.11447 0.15291
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
---------------------------------------------------------------------------------------------------
The random part estimates at the school level:
Coef. Std. Err.
var_Intercept_binexam 0.40677 0.08487
cov_Intercept_binexam_Intercept_binlrt 0.20759 0.05586
var_Intercept_binlrt 0.22560 0.05239
---------------------------------------------------------------------------------------------------
The random part estimates at the l1id level:
Coef. Std. Err.
var_bcons_1 1.00000 0.00000
cov_bcons_1_bcons_2 0.42477 0.01194
var_bcons_2 1.00000 0.00000
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
richardparker
Posts: 61
Joined: Fri Oct 23, 2009 1:49 pm

Re: Bivariate Logistic Distribution

Post by richardparker »

Hi - yes, the estimated (variance and covariance of the) random effects of a logit model will differ to those from a probit model due to the different link functions used. You can try this yourself, e.g. by fitting a simpler model, such as a univariate response model, and switching between logit and probit links to explore how the estimated random effects change. In case of interest, Modules 6 and 7 of the (free) LEMMA course (https://www.cmm.bris.ac.uk/lemma/course/view.php?id=13) provide some further explanation of differences in the interpretation of logit and probit models, and there are also examples of fitting multivariate response models in the MLwiN User Manual and MCMC Manual which may be useful. If you wish to see the various estimates represented in a model equation, then it may be helpful to run a version of the model which specifies estoptions = list(debugmode = TRUE) to open the MLwiN GUI (although only available on Windows), and then pressing "More" or "Start" to fit the model with the estimates returned in an equation format.
mariahcarey
Posts: 1
Joined: Fri Jan 19, 2024 6:57 am

Re: Bivariate Logistic Distribution

Post by mariahcarey »

To gain information about an agent's "rate," you might consider incorporating time-related covariates or interactions between covariates and timewordle game. This could capture changes in the decision-making process over time. Additionally, you can explore non-linear relationships between responses using polynomial terms or other non-linear transformations.
dtaylor7
Posts: 6
Joined: Tue Dec 12, 2023 5:08 pm

Re: Bivariate Logistic Distribution

Post by dtaylor7 »

Thank you Richard, the LEMMA course has been incredibly useful.
tonyadams
Posts: 6
Joined: Fri Jun 16, 2023 9:24 am

Re: Bivariate Logistic Distribution

Post by tonyadams »

dtaylor7 wrote: Thu Dec 14, 2023 2:46 pm Hello,

I am attempting to model two binary responses that represent two agents' decisions on the same task. Decisions are nested within agents which are nested within centres, are influenced by several covariates, and the marginal probabilities of the two decisions are identical except for when the second agent can see the first's response. Agents only ever act within a single centre.

2) If, in some centres/in the case of disagreements, a third agent was then to use decision1, decision2 and all the other information available to make a final decision for each task, how could this be modelled? Is it possible to also model a third binary response variable?
Yes, you can model a third binary response variable. You can extend your model to include the third decision as another separate response along with the original two. Each response would have its own set of predictors and random effects. fnf
Post Reply