Announcement

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

  • Commands that should give the same results do not. (xtreg, & gsem)

    Dear all,

    I’m running three different commands in SAS that should give me the same results, where the cluster ID is branch

    Command 1 and Command 2 give me the same result
    However, Command 3, which should give me the same result does not.
    Can someone please explain why Command 2 does not give me the same results as Command 3?


    For Command 1 and Command 2,
    The coefficeints on support and satis are 0.7139836 and 0.5490609 respectively

    However for Command 3, ...
    The coefficeints on support and satis are 0.6981603 and 0.6042986 respectively

    Is the reason possible because command 3 uses random effects and command 2 uses fixed effects?


    support .7139836 .0251594 28.38 0.000 .6646302 .7633371
    satis .5490609

    Variables include:
    branch [large department store in 75 locations | cluster variable or group variable]
    perform (Y variable) job performance [from 1500 employees]
    satis (M variable) job satisfaction [from 1500 employees]
    support (X variable) perceived support from managers

    Command 1: Using xtreg

    use https://www.stata-press.com/data/r18/gsem_multmed
    xtset branch
    xtreg perform support satis, fe

    Command 2: Using gsem

    use https://www.stata-press.com/data/r18/gsem_multmed
    gsem (perform<-support satis i.branch L, regress)

    Command 3: Using gsem

    use https://www.stata-press.com/data/r18/gsem_multmed
    gsem (perform<-support satis M1[branch] L, regress)


    Any help would be really appreciated here?

    The results from all 3 commands are below.



    . do "C:\Users\rseg6065\AppData\Local\Temp\STD77e4_0000 00.tmp"

    . use https://www.stata-press.com/data/r18/gsem_multmed
    (Fictional job-performance data)

    . xtset branch

    Panel variable: branch (balanced)

    . xtreg perform support satis, fe

    Fixed-effects (within) regression Number of obs = 1,500
    Group variable: branch Number of groups = 75

    R-squared: Obs per group:
    Within = 0.5317 min = 20
    Between = 0.6588 avg = 20.0
    Overall = 0.5392 max = 20

    F(2,1423) = 807.74
    corr(u_i, Xb) = 0.2744 Prob > F = 0.0000


    perform Coefficient Std. err. t P>t [95% conf. interval]

    support .7139836 .0251594 28.38 0.000 .6646302 .7633371
    satis .5490609 .0344488 15.94 0.000 .4814851 .6166367
    _cons 4.987632 .0115951 430.15 0.000 4.964887 5.010377

    sigma_u .4419321
    sigma_e .44829979
    rho .49284752 (fraction of variance due to u_i)

    F test that all u_i=0: F(74, 1423) = 15.03 Prob > F = 0.0000

    .
    end of do-file

    . do "C:\Users\rseg6065\AppData\Local\Temp\STD77e4_0000 00.tmp"

    . use https://www.stata-press.com/data/r18/gsem_multmed
    (Fictional job-performance data)

    . gsem (perform<-support satis i.branch L, regress)

    Fitting fixed-effects model:

    Iteration 0: log likelihood = -885.44481
    Iteration 1: log likelihood = -885.44481

    Refining starting values:

    Grid node 0: log likelihood = -1629.4487

    Fitting full model:

    Iteration 0: log likelihood = -1629.4487 (not concave)
    Iteration 1: log likelihood = -1486.8896 (not concave)
    Iteration 2: log likelihood = -1425.1065 (not concave)
    Iteration 3: log likelihood = -1401.0718 (not concave)
    Iteration 4: log likelihood = -1398.7055 (not concave)
    Iteration 5: log likelihood = -1396.8134 (not concave)
    Iteration 6: log likelihood = -1396.4355 (not concave)
    Iteration 7: log likelihood = -1396.3599 (not concave)
    Iteration 8: log likelihood = -1396.3523 (not concave)
    Iteration 9: log likelihood = -1396.3463 (not concave)
    Iteration 10: log likelihood = -1396.346 (not concave)
    Iteration 11: log likelihood = -1396.3457 (not concave)
    Iteration 12: log likelihood = -1396.3457 (not concave)
    Iteration 13: log likelihood = -1396.3457 (not concave)
    Iteration 14: log likelihood = -1396.3457 (not concave)
    Iteration 15: log likelihood = -1396.3457 (not concave)
    Iteration 16: log likelihood = -1396.3457 (not concave)
    Iteration 17: log likelihood = -1396.3457 (not concave)
    Iteration 18: log likelihood = -1396.3457 (not concave)
    Iteration 19: log likelihood = -1396.3457 (not concave)
    Iteration 20: log likelihood = -1396.3457 (not concave)
    Iteration 21: log likelihood = -1396.3457 (not concave)
    Iteration 22: log likelihood = -1396.3457 (not concave)
    Iteration 23: log likelihood = -1396.3457 (not concave)
    Iteration 24: log likelihood = -1396.3457 (not concave)
    Iteration 25: log likelihood = -1396.3457 (not concave)
    Iteration 26: log likelihood = -1396.3457 (not concave)
    Iteration 27: log likelihood = -1396.3457 (not concave)
    Iteration 28: log likelihood = -1396.3457 (not concave)
    Iteration 29: log likelihood = -1396.3457 (not concave)
    Iteration 30: log likelihood = -1396.3457 (not concave)
    Iteration 31: log likelihood = -1396.3457 (not concave)
    Iteration 32: log likelihood = -1396.3457 (not concave)
    Iteration 33: log likelihood = -1396.3454 (not concave)
    Iteration 34: log likelihood = -1396.3454 (not concave)
    Iteration 35: log likelihood = -1396.3436 (not concave)
    Iteration 36: log likelihood = -1396.3436 (not concave)
    Iteration 37: log likelihood = -1396.3434 (not concave)
    Iteration 38: log likelihood = -1396.3291 (not concave)
    Iteration 39: log likelihood = -1396.3277 (not concave)
    Iteration 40: log likelihood = -1396.2545 (not concave)
    Iteration 41: log likelihood = -1396.1374 (not concave)
    Iteration 42: log likelihood = -1395.9499 (not concave)
    Iteration 43: log likelihood = -1395.9125 (not concave)
    Iteration 44: log likelihood = -1394.9524 (not concave)
    Iteration 45: log likelihood = -1394.5685 (not concave)
    Iteration 46: log likelihood = -1393.3396 (not concave)
    Iteration 47: log likelihood = -1393.2782 (not concave)
    Iteration 48: log likelihood = -1391.7052 (not concave)
    Iteration 49: log likelihood = -1391.0764 (not concave)
    Iteration 50: log likelihood = -1382.9928 (not concave)
    Iteration 51: log likelihood = -892.31152
    Iteration 52: log likelihood = -886.52405 (not concave)
    Iteration 53: log likelihood = -885.44561 (not concave)
    Iteration 54: log likelihood = -885.44481 (not concave)
    Iteration 55: log likelihood = -885.44481 (not concave)
    Iteration 56: log likelihood = -885.44481 (not concave)
    Iteration 57: log likelihood = -885.44481 (backed up)

    Generalized structural equation model Number of obs = 1,500
    Response: perform
    Family: Gaussian
    Link: Identity
    Log likelihood = -885.44481

    ( 1) [perform]L = 1

    Coefficient Std. err. z P>z [95% conf. interval]

    perform
    support .7139836 .024505 29.14 0.000 .6659548 .7620124
    satis .5490609 .0335527 16.36 0.000 .4832987 .614823

    branch
    2 -.5815346 .1381258 -4.21 0.000 -.8522561 -.310813
    3 .0468524 .138654 0.34 0.735 -.2249044 .3186092
    4 -.462136 .1382752 -3.34 0.001 -.7331504 -.1911216
    5 .3404709 .1383197 2.46 0.014 .0693693 .6115725
    6 1.200632 .1401391 8.57 0.000 .9259649 1.4753
    7 .1456119 .1394184 1.04 0.296 -.1276431 .4188669
    8 .1823682 .1394647 1.31 0.191 -.0909775 .455714
    9 .0231412 .138296 0.17 0.867 -.247914 .2941964
    10 .9177335 .1441693 6.37 0.000 .635167 1.2003
    11 .3861063 .1388028 2.78 0.005 .1140578 .6581548
    12 -.0760954 .1381769 -0.55 0.582 -.3469172 .1947264
    13 .0474839 .1389987 0.34 0.733 -.2249486 .3199163
    14 .5582964 .1391763 4.01 0.000 .2855158 .831077
    15 .8265082 .1501036 5.51 0.000 .5323105 1.120706
    16 -.4437192 .1394772 -3.18 0.001 -.7170895 -.1703488
    17 -.2131928 .138107 -1.54 0.123 -.4838776 .057492
    18 .4292715 .1445243 2.97 0.003 .1460091 .7125339
    19 .6424994 .1424461 4.51 0.000 .3633101 .9216888
    20 .4594176 .1389425 3.31 0.001 .1870954 .7317398
    21 .8956857 .1439646 6.22 0.000 .6135202 1.177851
    22 .096672 .1380901 0.70 0.484 -.1739797 .3673236
    23 .4863984 .1400319 3.47 0.001 .2119408 .7608559
    24 .513326 .1396746 3.68 0.000 .2395688 .7870832
    25 .1286559 .1397268 0.92 0.357 -.1452035 .4025154
    26 .669922 .1418006 4.72 0.000 .391998 .947846
    27 -.0151282 .1401642 -0.11 0.914 -.289845 .2595886
    28 .16641 .1381439 1.20 0.228 -.1043471 .4371671
    29 -.6088293 .1393606 -4.37 0.000 -.881971 -.3356876
    30 1.15589 .1449833 7.97 0.000 .871728 1.440052
    31 .5958819 .1381038 4.31 0.000 .3252034 .8665605
    32 .1719484 .1380808 1.25 0.213 -.098685 .4425817
    33 .395337 .1436668 2.75 0.006 .1137552 .6769188
    34 -.6017857 .1382228 -4.35 0.000 -.8726973 -.330874
    35 -.0230875 .1385286 -0.17 0.868 -.2945986 .2484237
    36 .2623954 .1384524 1.90 0.058 -.0089664 .5337571
    37 .5017414 .1418911 3.54 0.000 .22364 .7798427
    38 1.210847 .1401491 8.64 0.000 .9361596 1.485534
    39 .7535965 .1387326 5.43 0.000 .4816857 1.025507
    40 .8522359 .1389066 6.14 0.000 .579984 1.124488
    41 .5151008 .1384598 3.72 0.000 .2437247 .786477
    42 .5951251 .1387706 4.29 0.000 .3231398 .8671105
    43 .6375748 .1407626 4.53 0.000 .3616852 .9134643
    44 .8046811 .1410768 5.70 0.000 .5281757 1.081187
    45 .4991278 .1474609 3.38 0.001 .2101098 .7881458
    46 .760281 .1411274 5.39 0.000 .4836763 1.036886
    47 -.0705665 .1384529 -0.51 0.610 -.3419292 .2007963
    48 .9216263 .1439826 6.40 0.000 .6394256 1.203827
    49 .6474784 .1382762 4.68 0.000 .376462 .9184948
    50 .261228 .1383697 1.89 0.059 -.0099716 .5324276
    51 .4130079 .1415381 2.92 0.004 .1355984 .6904174
    52 .198901 .1416375 1.40 0.160 -.0787034 .4765054
    53 .1324934 .1386533 0.96 0.339 -.1392621 .4042489
    54 .9498633 .1420625 6.69 0.000 .6714258 1.228301
    55 .2367334 .1385218 1.71 0.087 -.0347644 .5082312
    56 .165609 .1396473 1.19 0.236 -.1080947 .4393128
    57 .1669833 .1387411 1.20 0.229 -.1049443 .4389108
    58 .2675435 .1403303 1.91 0.057 -.0074989 .5425859
    59 -.2295663 .1388381 -1.65 0.098 -.5016839 .0425513
    60 -.7067141 .1383955 -5.11 0.000 -.9779643 -.435464
    61 .9114248 .138265 6.59 0.000 .6404304 1.182419
    62 .6805134 .1385357 4.91 0.000 .4089884 .9520384
    63 -.0306791 .1381078 -0.22 0.824 -.3013655 .2400073
    64 .0755469 .1381387 0.55 0.584 -.1951999 .3462938
    65 .6785538 .1419577 4.78 0.000 .4003218 .9567859
    66 .002009 .1381135 0.01 0.988 -.2686885 .2727065
    67 .6825912 .1417638 4.81 0.000 .4047393 .9604431
    68 .2698958 .1381926 1.95 0.051 -.0009566 .5407483
    69 .4812352 .1390728 3.46 0.001 .2086576 .7538129
    70 -.3764502 .1390206 -2.71 0.007 -.6489256 -.1039748
    71 .7262577 .1403353 5.18 0.000 .4512055 1.00131
    72 .7607011 .1435909 5.30 0.000 .4792681 1.042134
    73 .1532976 .1381588 1.11 0.267 -.1174887 .424084
    74 .7704471 .1383511 5.57 0.000 .4992839 1.04161
    75 .0521144 .1381002 0.38 0.706 -.218557 .3227857

    L 1 (constrained)
    _cons 4.653742 .098802 47.10 0.000 4.460093 4.84739

    var(L) 1.53e-34 6.66e-19 . .

    var(e.perform) .1906537 .0069616 .177486 .2047983


    .
    end of do-file

    . do "C:\Users\rseg6065\AppData\Local\Temp\STD77e4_0000 00.tmp"

    . use https://www.stata-press.com/data/r18/gsem_multmed
    (Fictional job-performance data)

    . gsem (perform<-support satis M1[branch] L, regress)

    Fitting fixed-effects model:

    Iteration 0: log likelihood = -1318.6577
    Iteration 1: log likelihood = -1318.6577

    Refining starting values:

    Grid node 0: log likelihood = -1778.9315

    Fitting full model:

    Iteration 0: log likelihood = -1778.9315 (not concave)
    Iteration 1: log likelihood = -1423.7726 (not concave)
    Iteration 2: log likelihood = -1394.8369 (not concave)
    Iteration 3: log likelihood = -1391.9978 (not concave)
    Iteration 4: log likelihood = -1390.8638 (not concave)
    Iteration 5: log likelihood = -1390.4104 (not concave)
    Iteration 6: log likelihood = -1390.3198 (not concave)
    Iteration 7: log likelihood = -1390.2473 (not concave)
    Iteration 8: log likelihood = -1390.24 (not concave)
    Iteration 9: log likelihood = -1390.2393 (not concave)
    Iteration 10: log likelihood = -1390.2387 (not concave)
    Iteration 11: log likelihood = -1390.2387 (not concave)
    Iteration 12: log likelihood = -1390.2386 (not concave)
    Iteration 13: log likelihood = -1390.2386 (not concave)
    Iteration 14: log likelihood = -1390.2386 (not concave)
    Iteration 15: log likelihood = -1390.2386 (not concave)
    Iteration 16: log likelihood = -1390.2386 (not concave)
    Iteration 17: log likelihood = -1390.2386 (not concave)
    Iteration 18: log likelihood = -1390.2386 (not concave)
    Iteration 19: log likelihood = -1390.2386 (not concave)
    Iteration 20: log likelihood = -1390.2386 (not concave)
    Iteration 21: log likelihood = -1390.2386 (not concave)
    Iteration 22: log likelihood = -1390.2386 (not concave)
    Iteration 23: log likelihood = -1390.2386 (not concave)
    Iteration 24: log likelihood = -1390.2386 (not concave)
    Iteration 25: log likelihood = -1390.2386 (not concave)
    Iteration 26: log likelihood = -1390.2386 (not concave)
    Iteration 27: log likelihood = -1390.2386 (not concave)
    Iteration 28: log likelihood = -1390.2386 (not concave)
    Iteration 29: log likelihood = -1390.2386 (not concave)
    Iteration 30: log likelihood = -1390.2386 (not concave)
    Iteration 31: log likelihood = -1390.2386 (not concave)
    Iteration 32: log likelihood = -1390.2386 (not concave)
    Iteration 33: log likelihood = -1390.2386 (not concave)
    Iteration 34: log likelihood = -1390.2386 (not concave)
    Iteration 35: log likelihood = -1390.2381 (not concave)
    Iteration 36: log likelihood = -1390.2381 (not concave)
    Iteration 37: log likelihood = -1390.2345 (not concave)
    Iteration 38: log likelihood = -1390.2342 (not concave)
    Iteration 39: log likelihood = -1390.2319 (not concave)
    Iteration 40: log likelihood = -1390.2282 (not concave)
    Iteration 41: log likelihood = -1390.2268 (not concave)
    Iteration 42: log likelihood = -1390.2266 (not concave)
    Iteration 43: log likelihood = -1390.2248 (not concave)
    Iteration 44: log likelihood = -1390.177 (not concave)
    Iteration 45: log likelihood = -1389.8712 (not concave)
    Iteration 46: log likelihood = -1389.749 (not concave)
    Iteration 47: log likelihood = -1389.7245 (not concave)
    Iteration 48: log likelihood = -1384.7023 (not concave)
    Iteration 49: log likelihood = -1380.6902 (not concave)
    Iteration 50: log likelihood = -1379.8898 (not concave)
    Iteration 51: log likelihood = -1369.5935 (not concave)
    Iteration 52: log likelihood = -1369.3379 (not concave)
    Iteration 53: log likelihood = -1259.0283 (not concave)
    Iteration 54: log likelihood = -1218.0217 (not concave)
    Iteration 55: log likelihood = -1096.0902 (not concave)
    Iteration 56: log likelihood = -1075.3566
    Iteration 57: log likelihood = -1047.2643 (not concave)
    Iteration 58: log likelihood = -1047.0937
    Iteration 59: log likelihood = -1035.5694
    Iteration 60: log likelihood = -1033.3888 (not concave)
    Iteration 61: log likelihood = -1033.3888 (not concave)
    Iteration 62: log likelihood = -1033.3887 (not concave)
    Iteration 63: log likelihood = -1033.3887
    Iteration 64: log likelihood = -1033.3878 (not concave)
    Iteration 65: log likelihood = -1033.3868 (not concave)
    Iteration 66: log likelihood = -1033.3868 (not concave)
    Iteration 67: log likelihood = -1033.3868

    Generalized structural equation model Number of obs = 1,500
    Response: perform
    Family: Gaussian
    Link: Identity
    Log likelihood = -1033.3868

    ( 1) [perform]M1[branch] = 1
    ( 2) [perform]L = 1

    Coefficient Std. err. z P>z [95% conf. interval]

    perform
    support .6981603 .0250434 27.88 0.000 .6490762 .7472444
    satis .6042986 .03364 17.96 0.000 .5383654 .6702317

    M1[branch] 1 (constrained)

    L 1 (constrained)
    _cons 4.986597 .0489469 101.88 0.000 4.890663 5.082531

    var(M1[branch]) .1695987 .0302887 .1195105 .2406796
    var(L) 4.51e-35 4.08e-19 . .

    var(e.perform) .2010552 .0075452 .1867976 .2164011


    .
    end of do-file

    .
Working...
X