Announcement

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

  • Comparing rho between two xtlogit models run in two complementary subsets

    Hi Statalisters

    I'm analysing the vaccination uptake (dependent variable: vaccinated; first level: individuals) among General Practitioners (second level: GPs) of my Local Health Unit.
    Covariates are gender, citizenship and calendar year (year a vs year b, after the approval of a new medical contract).

    I ran two xtlogit models in two complementary subsets of my data (year a, year,b) and I need to confront the second-level variability of these models, testing if rho in year b is significantly different from rho in year a, as it apparently is.

    As for the code, I use the union.dta
    use http://www.stata-press.com/data/r13/union, clear
    xtlogit union age grade not_smsa south year if black==0
    est store noblack
    xtlogit union age grade not_smsa south year if black==1
    est store black
    How can I compare /lnsig2u of these two models?
    Or better, how can I compare rho of these two models?

    Thanks for your help.

    Dr. Mario Saugo
    Dr. Luca Perin
    Epidemiological Service
    Local Health Unit 7
    Veneto Region

  • #2
    Mario:
    the following thread might be useful: https://www.statalist.org/forums/for...-different-rho
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Originally posted by Mario Saugo View Post
      how can I compare rho of these two models?
      Here are two ways, Wald test (Method 1) and likelihood-ratio test (Method 2). I illustrate both below using your example.
      Code:
      version 17.0
      
      clear
      
      quietly use http://www.stata-press.com/data/r13/union
      
      *
      * Begin here
      *
      contract idcode age grade not_smsa south year black union, freq(count)
      quietly reshape wide union, i(idcode year age grade not_smsa south count) j(black)
      
      gsem ///
          (union0 <- c.(age grade) i.(not_smsa south year) M0[idcode], logit) ///
          (union1 <- c.(age grade) i.(not_smsa south year) M1[idcode], logit), ///
              fweights(count) covariance(M0[idcode]*M1[idcode]@0) nocnsreport nodvheader nolog
      estimates store Free
      
      // Method 1
      test _b[/:var(M0[idcode])] = _b[/:var(M1[idcode])]
      
      // Method 2
      constraint define 1 _b[/:var(M0[idcode])] = _b[/:var(M1[idcode])]
      quietly gsem ///
          (union0 <- c.(age grade) i.(not_smsa south year) M0[idcode]@1, logit) ///
          (union1 <- c.(age grade) i.(not_smsa south year) M1[idcode]@1, logit), ///
              fweights(count) covariance(M0[idcode]*M1[idcode]@0) constraints(1)
      lrtest Free
      
      exit
      Because rho differs from the corresponding variance by only a constant, and it's the same constant for both, a comparison of the variances is exactly the same as a comparison of the rhos.

      Comment


      • #4
        Dear Joseph Coveney,

        it took me some months to understand and appreciate your proposal and your code, because I'm not used to GSEM.
        I thank you very much!

        Mario Saugo

        Comment

        Working...
        X