Announcement

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

  • random coefficient model

    Hi statalists!
    I have a question for the syntax for random coefficient model. The data is one year data.
    I would like to see the returns to education by age using random coefficient model.

    I have variables: ttlwages (total wages during last 30 days), edu (education level), age (age), age_squ (the square of age).

    I have tried

    code: mixed ttlwagesedu ||age: edu

    But I could not get the result by age. How can I get the returns to education by age?
    I would appreciate if you could any comments on this. Thank you in advance.

  • #2
    Shisho:
    as I do not see any nesting structure with your data, I would have started with an OLS.
    Without seeing what Stata gave you back, It's also difficult to interpret the core of your complaint about -age- results.
    As per your code, I would have replaced -age- with -personid- (or whatever -id- identifies your observations.
    Last (but I'm afraid) not least, your regression model may suffer from endogeneity, in that individual ability can well influence both education attainments as well as gross/disposable income.
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Dear Carlo,
      Thank you for your suggestion!!
      What I would like to see is the difference in the coefficient on the education (returns to education, the impact of education on total wages) by age.
      For example, if I use the OLS by age, then I use this code:
      bysort age: reg ttlwagesedu age age_squ
      I would like to apply this to this random coefficient model.
      I used the random coefficient model because maybe all people have different returns to education.


      The sample of the individual is classified 22 provinces, so it is nested I think?
      Because people who live in the city maybe earn more than those who are in rural area.
      I do not have any variable for the ability (IQ or test score, something like that,,), how can I deal with this?

      I include my data below for understanding.

      . dataex ttlwages edu age age_squ

      ----------------------- copy starting from the next line -----------------------
      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input long ttlwages float edu byte age float age_squ
          0  4 35 1225
          0  4 32 1024
          0  . 36 1296
          0  . 40 1600
          0  5 49 2401
          0  6 41 1681
       9000  . 29  841
      10000  . 49 2401
      12000  . 39 1521
      14000  6 32 1024
      14000  9 26  676
      15000  6 73 5329
      15000  5 25  625
      15000  . 42 1764
      18000  7 19  361
      20000  8 71 5041
      20000  5 37 1369
      20000 12 24  576
      20000  8 28  784
      20000  8 30  900
      20000  7 32 1024
      20000  7 76 5776
      23000  . 19  361
      25000 18 21  441
      25000  4 33 1089
      25300  3 40 1600
      30000  6 59 3481
      30000  . 54 2916
      30000  . 66 4356
      30000  . 70 4900
      30000  7 27  729
      30000  8 18  324
      30000  5 46 2116
      30000  7 52 2704
      30000  . 48 2304
      30000  4 22  484
      30000  4 31  961
      30000  2 55 3025
      30000  2 31  961
      30000  4 63 3969
      30000  5 60 3600
      30000  4 51 2601
      30000  7 42 1764
      30000  . 33 1089
      35000  8 40 1600
      37500  3 23  529
      37500  4 53 2809
      37500  . 48 2304
      37500  6 25  625
      40000  5 24  576
      40000  . 40 1600
      40000  3 37 1369
      40000  7 30  900
      40000  8 69 4761
      40000  . 46 2116
      40000  6 45 2025
      40000  8 26  676
      40000  3 44 1936
      40000  8 18  324
      40000  8 55 3025
      40000 13 32 1024
      40000  . 51 2601
      40000  . 58 3364
      40000  . 51 2601
      40000 10 37 1369
      40000  4 55 3025
      40000  8 24  576
      40000 13 32 1024
      40000 13 27  729
      40000  7 27  729
      40000  5 53 2809
      40000  9 58 3364
      40000  . 29  841
      40000  6 24  576
      42000 10 23  529
      42500  5 29  841
      44000 11 25  625
      45000  2 49 2401
      45000  7 22  484
      45000  . 49 2401
      45000  . 50 2500
      45000 15 21  441
      45000  . 45 2025
      45000  . 30  900
      46000  . 44 1936
      48000  5 25  625
      48000  8 27  729
      48000  7 24  576
      48000  0 30  900
      48000  9 27  729
      48000 10 31  961
      48000  4 34 1156
      48000  6 30  900
      48000 10 44 1936
      48000  . 21  441
      50000 13 31  961
      50000  4 20  400
      50000  5 59 3481
      50000  . 49 2401
      50000  2 50 2500
      end

      Comment


      • #4
        Shisho:
        as far as I can see your data excerpt, I find no clue of nesting.
        That said, I would go -regress-, interacting age with education:
        Code:
        . reg ttlwages c.age##c.edu
        
              Source |       SS           df       MS      Number of obs   =        74
        -------------+----------------------------------   F(3, 70)        =      0.59
               Model |   301586512         3   100528837   Prob > F        =    0.6263
            Residual |  1.2014e+10        70   171621770   R-squared       =    0.0245
        -------------+----------------------------------   Adj R-squared   =   -0.0173
               Total |  1.2315e+10        73   168700143   Root MSE        =     13100
        
        ------------------------------------------------------------------------------
            ttlwages |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
                 age |  -107.1766   306.6956    -0.35   0.728    -718.8616    504.5085
                 edu |    285.314   1480.071     0.19   0.848    -2666.595    3237.223
                     |
         c.age#c.edu |  -.2763659   44.62755    -0.01   0.995    -89.28322    88.73048
                     |
               _cons |    35696.6   11193.83     3.19   0.002      13371.2       58022
        ------------------------------------------------------------------------------
        https://www.stata.com/bookstore/micr...metrics-stata/ (pages: 178-180) use proximity to college as an instrumental variable to fix ability-related endogeneity issue.
        Kind regards,
        Carlo
        (Stata 18.0 SE)

        Comment

        Working...
        X