Announcement

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

  • Variance decomposition to check which panel model to run

    Hello,
    I has posted previously asking for advice. Im restating my request again.
    I would like to do a variance decompostion of vc_body_out (x) to check if there is sufficent variation over the years to run a FE model.
    How will I be able to do that?
    How do I look for between and within variation in distid. distid is the unique district identifier.
    My model is

    Code:
    xtset distid
    xtreg read_score vc_body_out,fe cl(distid)
    C
    Code:
    Code: 
     ----------------------- copy starting from the next line -----------------------   Code:  
     * Example generated by -dataex-. To install: ssc install dataex clear input str21 State_name_census byte State_code_census str26 district_name_census byte Dist_code_census float distid int year byte read_score float z_read_score int vc_body_out float lag0log_vc_body_out int vc_pubsafety float lag0log_vc_pubsafety "Karnataka"        29 "Tumkur"              18 516 2007 . . 142  4.962845 200  5.303305 "Karnataka"        29 "Tumkur"              18 516 2007 . . 142  4.962845 200  5.303305 "Assam"            18 "Sonitpur"            11 277 2007 . . 200  5.303305 107 4.6821313 "Uttaranchal"       5 "Uttarkashi"           1  44 2007 . .  15  2.772589  22  3.135494 "Karnataka"        29 "Tumkur"              18 516 2007 . . 142  4.962845 200  5.303305 "Karnataka"        29 "Tumkur"              18 516 2007 . . 142  4.962845 200  5.303305 "Assam"            18 "Dhemaji"             13 279 2007 . .  88 4.4886365  34  3.555348 "Jharkhand"        20 "Garhwa"               1 307 2007 . . 121  4.804021 150   5.01728 "Rajasthan"         8 "Jaisalmer"           16  91 2007 . .  21 3.0910425  29 3.4011974 "Karnataka"        29 "Tumkur"              18 516 2007 . . 142  4.962845 200  5.303305 "Maharashtra"      27 "Nandurbar"            1 444 2007 . .  55 4.0253515  97 4.5849676 "Chhatisgarh"      22 "Raigarh"              4 358 2007 . .  99 4.6051702 100 4.6151204 "Orissa"           21 "Cuttack"             12 336 2007 . . 154  5.043425 127   4.85203 "Uttar Pradesh"     9 "Budaun"              19 126 2007 . . 309  5.736572  29 3.4011974 "Madhya Pradesh"   23 "Dhar"                25 395 2007 . . 163  5.099866 105 4.6634393 "Himachal Pradesh"  2 "Sirmaur"             10  24 2007 . .  32  3.496508  65  4.189655 "Himachal Pradesh"  2 "Hamirpur"             6  20 2007 . .  25 3.2580965  47  3.871201 "Tamil Nadu"       33 "Nagapattinam"        19 559 2007 . . 132  4.890349  68 4.2341065 "Karnataka"        29 "Tumkur"              18 516 2007 . . 142  4.962845 200  5.303305 "Andhra Pradesh"   28 "Mahbubnagar"          7 482 2007 . . 353  5.869297 164  5.105946 "Karnataka"        29 "Chikmagalur"         17 515 2007 . .  74  4.317488 128  4.859812 "Karnataka"        29 "Tumkur"              18 516 2007 . . 142  4.962845 200  5.303305 "Haryana"           6 "Sirsa"               11  67 2007 . .  74  4.317488  52  3.970292 "Nagaland"         13 "Wokha"                5 235 2007 . .  15  2.772589   3 1.3862944 "Tamil Nadu"       33 "Pudukkottai"         22 562 2007 . .  91 4.5217886  54 4.0073333 "Jharkhand"        20 "Hazaribagh"           4 310 2007 . . 275  5.620401 315  5.755742 "Karnataka"        29 "Bijapur"              3 501 2007 . . 108  4.691348 321  5.774551 "Punjab"            3 "Faridkot"            13  39 2007 . .  70   4.26268   4  1.609438 "Karnataka"        29 "Chikmagalur"         17 515 2007 . .  74  4.317488 128  4.859812 "Uttar Pradesh"     9 "Jyotiba Phule Nagar"  6 113 2007 . . 163  5.099866  95  4.564348 "Karnataka"        29 "Bellary"             12 510 2007 . . 130  4.875197 233  5.455321 "Himachal Pradesh"  2 "Hamirpur"             6  20 2007 . .  25 3.2580965  47  3.871201 "Karnataka"        29 "Chikmagalur"         17 515 2007 . .  74  4.317488 128  4.859812 "Karnataka"        29 "Chikmagalur"         17 515 2007 . .  74  4.317488 128  4.859812 "Karnataka"        29 "Chikmagalur"         17 515 2007 . .  74  4.317488 128  4.859812 "Karnataka"        29 "Bangalore"           20 518 2007 . . 636  6.456769 427  6.059123 "Karnataka"        29 "Chikmagalur"         17 515 2007 . .  74  4.317488 128  4.859812 "Karnataka"        29 "Chikmagalur"         17 515 2007 . .  74  4.317488 128  4.859812 "Kerala"           32 "Kasaragod"            1 528 2007 . .  29 3.4011974 553  6.317165 "Himachal Pradesh"  2 "Hamirpur"             6  20 2007 . .  25 3.2580965  47  3.871201 "Karnataka"        29 "Kolar"               19 517 2007 . . 206  5.332719 330  5.802118 "Karnataka"        29 "Chikmagalur"         17 515 2007 . .  74  4.317488 128  4.859812 "Karnataka"        29 "Chikmagalur"         17 515 2007 . .  74  4.317488 128  4.859812 "Karnataka"        29 "Chikmagalur"         17 515 2007 . .  74  4.317488 128  4.859812 "Karnataka"        29 "Chikmagalur"         17 515 2007 . .  74  4.317488 128  4.859812 "Kerala"           32 "Malappuram"           5 532 2007 . .  71  4.276666 535  6.284134 "Himachal Pradesh"  2 "Bilaspur"             8  22 2007 . .  17  2.890372  46 3.8501475 "Himachal Pradesh"  2 "Bilaspur"             8  22 2007 . .  17  2.890372  46 3.8501475 "Karnataka"        29 "Chikmagalur"         17 515 2007 . .  74  4.317488 128  4.859812 "Tamil Nadu"       33 "The Nilgiris"        11 551 2007 . .  26  3.295837  15  2.772589 "Himachal Pradesh"  2 "Bilaspur"             8  22 2007 . .  17  2.890372  46 3.8501475 "Madhya Pradesh"   23 "Guna"                 7 377 2007 . . 156  5.056246 134  4.905275 "Andhra Pradesh"   28 "Rangareddi"           6 481 2007 . . 551  6.313548 207  5.337538 "Himachal Pradesh"  2 "Bilaspur"             8  22 2007 . .  17  2.890372  46 3.8501475 "Andhra Pradesh"   28 "Chittoor"            23 498 2007 . . 305  5.723585 122  4.812184 "Andhra Pradesh"   28 "Karimnagar"           3 479 2007 . . 375  5.929589 213  5.365976 "Karnataka"        29 "Chikmagalur"         17 515 2007 . .  74  4.317488 128  4.859812 "Rajasthan"         8 "Dausa"               11  86 2007 . . 120  4.795791  55 4.0253515 "Bihar"            10 "Darbhanga"           13 189 2007 . . 277  5.627621  95  4.564348 "Himachal Pradesh"  2 "Bilaspur"             8  22 2007 . .  17  2.890372  46 3.8501475 "Karnataka"        29 "Chikmagalur"         17 515 2007 . .  74  4.317488 128  4.859812 "Karnataka"        29 "Chikmagalur"         17 515 2007 . .  74  4.317488 128  4.859812 "Madhya Pradesh"   23 "Balaghat"            45 415 2007 . .  77  4.356709  28  3.367296 "Tamil Nadu"       33 "Cuddalore"           18 558 2007 . . 232  5.451038 193  5.267858 "Madhya Pradesh"   23 "Balaghat"            45 415 2007 . .  77  4.356709  28  3.367296 "Karnataka"        29 "Udupi"               16 514 2007 . .  32  3.496508 150   5.01728 "Haryana"           6 "Fatehabad"           10  66 2007 . .  71  4.276666  26  3.295837 "Karnataka"        29 "Udupi"               16 514 2007 . .  32  3.496508 150   5.01728 "Karnataka"        29 "Udupi"               16 514 2007 . .  32  3.496508 150   5.01728 "Jharkhand"        20 "Ranchi"              14 320 2007 . . 512  6.240276 240  5.484797 "Karnataka"        29 "Gulbarga"             4 502 2007 . . 236   5.46806 544  6.300786 "Karnataka"        29 "Udupi"               16 514 2007 . .  32  3.496508 150   5.01728 "Bihar"            10 "Sheohar"              3 179 2007 . .  63  4.158883  99 4.6051702 "Himachal Pradesh"  2 "Bilaspur"             8  22 2007 . .  17  2.890372  46 3.8501475 "Kerala"           32 "Kozhikode"            4 531 2007 . .  72 4.2904596 899  6.802395 "Karnataka"        29 "Udupi"               16 514 2007 . .  32  3.496508 150   5.01728 "Punjab"            3 "Amritsar"             2  28 2007 . . 346  5.849325   9 2.3025851 "Karnataka"        29 "Udupi"               16 514 2007 . .  32  3.496508 150   5.01728 "Kerala"           32 "Kozhikode"            4 531 2007 . .  72 4.2904596 899  6.802395 "Madhya Pradesh"   23 "Ujjain"              21 391 2007 . . 238  5.476463 126  4.844187 "Uttar Pradesh"     9 "Sultanpur"           49 155 2007 . . 194     5.273  41   3.73767 "Karnataka"        29 "Udupi"               16 514 2007 . .  32  3.496508 150   5.01728 "Jammu & Kashmir"   1 "Udhampur"            10  10 2007 . .  68 4.2341065  27 3.3322046 "Karnataka"        29 "Shimoga"             15 513 2007 . . 111 4.7184987 165  5.111988 "Gujarat"          24 "Porbandar"           11 426 2007 . .  19  2.995732  15  2.772589 "Karnataka"        29 "Shimoga"             15 513 2007 . . 111 4.7184987 165  5.111988 "Karnataka"        29 "Shimoga"             15 513 2007 . . 111 4.7184987 165  5.111988 "Orissa"           21 "Balangir"            24 348 2007 . . 125  4.836282 116  4.762174 "Tamil Nadu"       33 "Ramanathapuram"      27 567 2007 . . 117  4.770685  62 4.1431346 "Himachal Pradesh"  2 "Bilaspur"             8  22 2007 . .  17  2.890372  46 3.8501475 "Chhatisgarh"      22 "Dhamtari"            13 367 2007 . .  32  3.496508  32  3.496508 "Himachal Pradesh"  2 "Bilaspur"             8  22 2007 . .  17  2.890372  46 3.8501475 "Himachal Pradesh"  2 "Hamirpur"             6  20 2007 . .  25 3.2580965  47  3.871201 "Tamil Nadu"       33 "Cuddalore"           18 558 2007 . . 232  5.451038 193  5.267858 "Karnataka"        29 "Hassan"              23 521 2007 . . 105 4.6634393 130  4.875197 "Rajasthan"         8 "Udaipur"             26 101 2007 . . 311  5.743003 317  5.762052 "Karnataka"        29 "Shimoga"             15 513 2007 . . 111 4.7184987 165  5.111988 "Madhya Pradesh"   23 "Shahdol"             16 386 2007 . .  89 4.4998097  49  3.912023 "Karnataka"        29 "Udupi"               16 514 2007 . .  32  3.496508 150   5.01728 "Tamil Nadu"       33 "The Nilgiris"        11 551 2007 . .  26  3.295837  15  2.772589 end 
    ------------------ copy up to and including the previous line ------------------ Listed 100 out of 5710400 observations Use the count() option to list more
    ode:

  • #2
    Code:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float distid int(year vc_body_out) byte read_score
    158 2007  58 1
    249 2009   4 2
    130 2010 264 2
    390 2011 133 1
    378 2012  89 1
    246 2013  30 2
    254 2014   7 1
    286 2016  42 1
     67 2018 187 1
    end
    ------------------ copy up to and including the previous line ------------------ Listed 9 out of 9 observations
    Last edited by Raphael George; 03 Sep 2023, 23:10.

    Comment


    • #3
      I think this data example will be more helpful.
      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input float distid int(year vc_body_out) byte read_score
      77 2007 194 1
      77 2009 170 2
      77 2010 170 2
      77 2011 148 2
      77 2012 170 2
      77 2013 221 1
      77 2014 225 1
      77 2016 216 1
      77 2018 174 2
      end

      Comment


      • #4
        Code:
        xtset distid year
        xtsum vc_body_out read_score
        You can estimate the fixed effects model regardless, but you must justify estimating a random effects model. See the model-estimator matrix in https://www.stata.com/support/faqs/s...effects-model/ and

        Code:
        ssc describe xtoverid
        for a test of overidentifying restrictions in panel data.

        Comment

        Working...
        X