Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • help with a code for xtmelogit model

    Hello,

    I need your help with a STATA code for the logistic model with random effect.
    The model analyzes the effect of individual characteristics on level of trust to police.

    The formula of estimated mixed logit model looks like:
    Click image for larger version

Name:	экрана 2019-01-20 в 17.20.35.png
Views:	1
Size:	26.7 KB
ID:	1479731



    where i is the number of the individual, j is the number of the country, F is the logistic function, X1, ..., Xk are the individual characteristics (such as in the ordered logit models), and Zjis GDP and CPI.
    Dependent Variable = binary variable believe in police 1, 0 - otherwise.

    Indep. Variables = sex, age, educhigh, educmid, marital unemployed and author uses the country–level variables GDP and CPI which include both a deterministic part that is common to all countries and a random part that reflects the specific country.


    I know that the xtmelogit function is used to analyze the model.


    xtmelogit police sex age educhigh educmid marital unemployed | | ....

    My question: how the ending of the model should be coded with RE for GDP and CPI (Corruption Perception Index) ?

    Thanks!
    Last edited by Anna Petrova; 20 Jan 2019, 09:42.

  • #2
    First, if you are using Stata version 13 or later, -xtmelogit- has been replaced by two random effects logistic regression commands. -meqrlogit- uses the approach that -xtmelogit- used; -melogit- uses a different algorithm to estimate the same random effects regression model. One one fails to converge, the other often will. Let's say for the sake of discussion you will start with -meqrlogit-.

    meqrlogit police sex age educhigh educmid marital unemployed GDP CPI ///
    | | country: GDP CPI, cov(exch)
    ]

    Note that in order to get random slopes for GDP and CPI you must also include them in the fixed-effects part of the model. The -cov(exch)- option will give you the exchangeable covariance structure specified in your equation.

    Comment

    Working...
    X