Announcement

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

  • Help with comparing coefficients across 2 logistic regression models with the same independent variables but different dependent variables.

    Hello everyone,

    I want to compare the coefficients of Interlocked_breached_firmpre and Interlocked_breached_firmpost across 2 logistic regressions: one with Internal as DV and one with External as DV.
    I tried running the below codes:

    logit Internal Interlocked_breached_firmpre Interlocked_breached_firmpost
    estimates store model1
    logit External Interlocked_breached_firmpre Interlocked_breached_firmpost
    estimates store model2
    suest model1 model2

    test [model1] Interlocked_breached_firmpre = [model2] Interlocked_breached_firmpre
    test [model1_mean]Interlocked_breached_firmpre = [model2_mean]Interlocked_breached_firmpre



    But I keep getting errors on the "test" step.
    Could you please provide me with a correct way to determine whether the coefficients are statistically different across the 2 models?
    Also, please note that I have industry and year fixed effects.



    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(Internal External Interlocked_breached_firmpre Interlocked_breached_firmpost)
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 1 0
    0 0 1 0
    0 0 1 0
    0 1 1 0
    0 0 1 1
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 1 1
    0 0 1 1
    0 0 1 1
    0 0 1 0
    0 0 1 0
    0 0 1 0
    0 1 1 0
    0 0 0 1
    0 0 1 1
    0 0 1 1
    0 0 1 1
    0 0 1 0
    0 1 1 0
    0 1 0 1
    0 0 0 1
    0 0 0 1
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 1 0
    0 0 1 0
    0 0 1 0
    0 1 1 0
    1 0 1 1
    1 0 1 1
    1 0 1 1
    1 0 0 1
    0 0 0 1
    0 0 0 1
    0 0 1 0
    0 0 1 0
    0 0 0 0
    0 0 1 1
    0 0 0 1
    0 0 0 1
    0 0 0 1
    0 0 0 1
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 1 0
    0 0 1 1
    0 0 1 1
    0 0 1 1
    0 0 1 1
    0 0 1 1
    0 0 1 1
    0 0 0 1
    0 0 0 1
    0 0 0 1
    0 0 0 0
    0 0 0 1
    0 0 0 1
    0 0 1 1
    0 0 1 1
    0 0 1 1
    0 0 1 1
    0 0 1 1
    0 0 1 0
    0 0 1 0
    0 0 1 0
    0 0 1 0
    0 0 0 0
    0 0 0 1
    0 0 0 0
    0 0 1 0
    0 0 1 0
    0 0 1 0
    end

    Your help is highly appreciated!
    Christelle

  • #2
    Try something like the following. Begin at the "Begin here" comment.
    Code:
    version 18.0
    
    clear *
    
    set seed 870609315
    
    quietly set obs 250
    
    foreach var in Internal External Interlocked_breached_firmpre Interlocked_breached_firmpost {
        generate byte `var' = rbinomial(1, 0.5)
    }
    
    *
    * Begin here
    *
    quietly logit Internal i.(Interlocked_breached_firmpre Interlocked_breached_firmpost)
    estimates store model1
    
    quietly logit External i.(Interlocked_breached_firmpre Interlocked_breached_firmpost)
    estimates store model2
    suest model1 model2
    
    test [model1_Internal]1.Interlocked_breached_firmpre = ///
        [model2_External]1.Interlocked_breached_firmpre, notest
    test [model1_Internal]1.Interlocked_breached_firmpost = ///
        [model2_External]1.Interlocked_breached_firmpost, accumulate
    
    // Also consider
    rename *pre pre
    rename *post pos
    rename (Internal External) out#, addnumber(0)
    
    generate `c(obs_t)' row = _n
    quietly reshape long out, i(row) j(ext)
    logit out i.ext##i.(pre pos), nolog
    test 1.ext#1.pre, notest
    test 1.ext#1.pos, accumulate
    
    exit

    Comment


    • #3
      Sorry, I accidentally left something out of that alternative model
      Code:
      logit out i.ext##i.(pre pos), vce(cluster row) nolog

      Comment


      • #4
        Thank you Joseph!
        The codes worked.


        Comment

        Working...
        X