Announcement

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

  • Panel data with binary and group variables as independent variables

    Hello,

    I am new to Stata and Econometrics in general, and I am really struggling to choose the right method.

    I want to see if binary and group variables, respectively, can explain a continuous variable.

    I have unbalanced panel data (see below), where:
    • ID = Company
    • ME = Management Error = continuous variable. ME can be optimistic or pessimistic
    • ME ABS = Absolute value of ME = continuous variable.
    • OPTM = binary variable (1 of ME is optimistic; 0 if ME is pessimistic)
    • Year = from 2004 to 2007
    • Industry = Group variable
    • Item = Group variable ("EBITDA" = 5; "EBITA" = 4; "EBIT" = 3; "EBT" = 2; "Net Profit" = 1)
    • Margin = Binary variable (1 if Item is Margin; 0 otherwise)
    • CEO = ID for each CEO
    Specifically, I am interested in:

    1. Can following variables 1) explain if ME is optimistic or pessimistic?; 2) explain the level of Optimism and Pessimism, respectively in ME?; 3) explain the overall level of error (ME ABS)
    1.a. "Year"
    1.b. "Industry"
    1.c. "Item". I want to include Year and Industry fixed effects in this test.
    1.d. "Margin". I want to include Year and Industry fixed effects in this test.
    1.e. "CEO". I want to include Year and Industry fixed effects in this test.

    2. Finally, I want to include all significant results from (1) in an overall regression to explain ME with variables form related (continuous variables) as control variables.

    As I am using Panel Data, my understanding is that I should use xtreg to run regressions.

    However, because my x-variables is either Group or Binary, I would run a Anova test - but is this even possible for Panel data?

    I have provided a section of my dataset - I do not expect any significant results from it

    It would be very helpful if you could explain solutions to my problems in laymen terms and provide relevant stata codes.

    Best,
    Niels

    I have provided a section of my dataset for the purpose of methodology - I do not expect any significant results from it.
    ID ME ME ABS OPTM Year Industry Item Margin CEO
    3 0,003289 0,003289 1 2004 20 4 0 229
    3 0,025994 0,025994 1 2005 20 4 0 229
    3 0,009777 0,009777 1 2006 20 4 0 229
    3 0,036084 0,036084 1 2007 20 3 0 229
    5 0,00439 0,00439 1 2004 45 3 0 197
    5 -0,0031 0,003101 0 2005 45 3 0 322
    5 -0,01207 0,012073 0 2006 45 3 0 322
    5 -0,0168 0,016804 0 2007 45 3 0 322
    7 0,005895 0,005895 1 2004 20 3 1 400
    7 0,008512 0,008512 1 2005 20 3 1 400
    7 0,026977 0,026977 1 2006 20 3 1 400
    7 0,032442 0,032442 1 2007 20 3 1 400
    9 -0,03005 0,030051 0 2004 20 3 0 315
    9 -0,00589 0,005895 0 2005 20 3 0 315
    9 -0,01573 0,015732 0 2006 20 3 0 315
    9 0,011752 0,011752 1 2007 20 3 0 315
    10 -0,00454 0,004543 0 2004 50 2 0 324
    10 -0,00207 0,002071 0 2005 50 2 0 324
    10 -0,0202 0,020202 0 2006 50 2 0 324
    10 -0,01215 0,012154 0 2007 50 2 0 320
    12 -0,00625 0,006246 0 2004 50 4 0 254
    12 -0,00713 0,007126 0 2005 50 3 0 254
    12 -0,00932 0,009321 0 2006 50 3 0 230
    12 -0,00642 0,006419 0 2007 50 3 0 230
    13 0,021874 0,021874 1 2004 50 3 0 190
    13 -0,01695 0,016949 0 2005 50 3 0 190
    13 -0,02031 0,020307 0 2006 50 3 0 190
    13 -0,03125 0,031252 0 2007 50 3 0 190
    15 10,06413 10,06413 1 2004 20 3 0 260
    15 -0,88398 0,883975 0 2005 20 3 0 260
    15 -0,27877 0,278767 0 2006 20 3 0 260
    15 0,051239 0,051239 1 2007 20 3 0 260
    16 -0,01078 0,010779 0 2004 20 4 0 176
    16 -0,00768 0,007676 0 2005 20 4 0 176
    16 0,064459 0,064459 1 2006 20 4 0 176
    16 -0,04021 0,040211 0 2007 20 4 0 31
    20 -9,9E-05 9,86E-05 0 2004 50 2 0 312
    20 0,016801 0,016801 1 2005 50 2 0 312
    20 -0,01023 0,01023 0 2006 50 2 0 312
    20 0,028739 0,028739 1 2007 50 2 0 312
    21 -0,04622 0,046225 0 2004 20 3 0 71
    21 0,003363 0,003363 1 2005 20 3 0 71
    21 -0,01995 0,019954 0 2006 20 3 0 71
    23 -0,03273 0,03273 0 2004 50 1 0 177
    23 0,09583 0,09583 1 2005 50 1 0 177
    23 0,005724 0,005724 1 2006 50 1 0 177
    23 -0,00595 0,005945 0 2007 50 1 0 86
    26 -0,01327 0,013273 0 2004 20 3 0 246
    26 -0,02248 0,022482 0 2005 20 3 0 246
    26 -0,02724 0,027244 0 2007 20 3 0 246
    27 0,180393 0,180393 1 2004 20 3 0 396
    27 0,192757 0,192757 1 2005 20 3 0 396
    27 0,191469 0,191469 1 2006 20 3 0 396
    27 0,190959 0,190959 1 2007 20 3 0 396
    31 0,017358 0,017358 1 2004 45 2 0 370
    31 0,00561 0,00561 1 2005 45 2 0 370
    31 0,002792 0,002792 1 2006 45 2 0 370
    31 0,033438 0,033438 1 2007 45 2 0 370
    34 -0,08585 0,085846 0 2004 50 1 0 421
    34 -0,09493 0,094933 0 2005 50 1 0 84
    34 -0,16164 0,161637 0 2006 50 1 0 84
    34 -0,41045 0,410452 0 2007 50 1 0 84
    35 0,006808 0,006808 1 2004 50 2 0 157
    35 0,004284 0,004284 1 2005 50 2 0 157
    35 -0,05848 0,058479 0 2006 50 2 0 157
    35 0,003804 0,003804 1 2007 50 2 0 157
    36 1,013604 1,013604 1 2005 10 3 1 355
    36 -0,08956 0,08956 0 2006 10 3 1 355
    36 -0,06873 0,068732 0 2007 10 3 1 355
    42 0,072528 0,072528 1 2004 60 3 1 407
    42 0,066608 0,066608 1 2005 60 3 1 407
    42 0,000798 0,000798 1 2006 60 3 1 82
    42 -0,01694 0,016941 0 2007 60 3 1 82
    44 0,959915 0,959915 1 2004 20 2 0 365
    44 0,470113 0,470113 1 2005 20 1 0 365
    44 1,681689 1,681689 1 2006 20 3 0 365
    44 -0,90184 0,901837 0 2007 20 2 0 365
    46 -0,00323 0,003233 0 2004 40 2 0 426
    46 -0,00372 0,003716 0 2005 40 2 0 426
    46 -0,00777 0,00777 0 2006 40 2 0 426
    46 0,098069 0,098069 1 2007 40 2 0 426
    48 -0,08137 0,081365 0 2007 10 3 1 344
    49 0,016271 0,016271 1 2007 20 3 1 275
    50 0,008602 0,008602 1 2004 10 5 0 50
    50 0,021392 0,021392 1 2005 10 5 0 50
    50 0,001718 0,001718 1 2006 10 5 0 284
    50 -0,01793 0,01793 0 2007 10 5 0 284
    52 -0,06656 0,066564 0 2005 50 1 0 54
    52 -0,04578 0,045779 0 2006 50 1 0 54
    52 -0,09461 0,09461 0 2007 50 5 0 54
    53 -0,00702 0,007024 0 2004 40 1 0 191
    53 -0,01283 0,01283 0 2005 40 1 0 191
    53 0,007478 0,007478 1 2006 40 1 0 191
    54 0,00325 0,00325 1 2005 50 3 0 32
    54 0,022377 0,022377 1 2006 50 3 0 32
    54 -0,00536 0,005362 0 2007 50 3 0 348
    55 -0,00014 0,000143 0 2004 50 2 0 185
    55 0,010558 0,010558 1 2005 50 2 0 115
    55 -0,00842 0,008422 0 2006 50 2 0 115
    55 -0,02973 0,029726 0 2007 50 2 0 115
    60 -0,02101 0,021011 0 2004 50 1 0 422
    60 -0,00693 0,006926 0 2005 50 1 0 422
    60 -0,02111 0,02111 0 2006 50 2 0 416
    60 -0,01204 0,012045 0 2007 50 2 0 416
    65 -0,00952 0,00952 0 2004 50 2 0 83
    65 -0,00162 0,001619 0 2005 50 2 0 83
    65 -0,00111 0,001112 0 2006 50 2 0 83
    65 -0,01304 0,013041 0 2007 50 2 0 83
    66 0,04819 0,04819 1 2004 10 3 0 188
    66 0,016077 0,016077 1 2005 10 3 0 188
    66 0,264813 0,264813 1 2006 10 3 0 188
    66 0,271618 0,271618 1 2007 10 3 0 408
    68 -0,00458 0,004577 0 2004 50 2 0 182
    68 -0,0006 0,000604 0 2005 50 2 0 182
    68 -0,00206 0,002059 0 2006 50 2 0 182
    68 0,000628 0,000628 1 2007 50 2 0 98
    69 0,041654 0,041654 1 2004 50 2 0 253
    69 -0,01067 0,010671 0 2005 50 2 0 104
    69 -0,00986 0,009858 0 2006 50 2 0 104
    69 0,007243 0,007243 1 2007 50 2 0 104
    72 -0,07098 0,070978 0 2004 40 2 0 242
    72 -0,01853 0,018532 0 2005 40 2 0 242
    72 -0,00397 0,003967 0 2006 40 2 0 242
    72 0,045728 0,045728 1 2007 40 2 0 242
    73 -0,23154 0,231541 0 2005 50 2 0 219
    73 -0,07223 0,072227 0 2006 50 2 0 219
    73 -0,02269 0,02269 0 2007 50 2 0 219
    79 -0,00651 0,006508 0 2004 50 2 0 311
    79 -0,00091 0,000909 0 2005 50 2 0 311
    79 -0,01135 0,011354 0 2006 50 2 0 311
    79 0,031099 0,031099 1 2007 50 2 0 311
    82 0,19635 0,19635 1 2005 20 4 0 131
    82 3,281779 3,281779 1 2006 20 3 0 410
    82 0,211511 0,211511 1 2007 20 1 0 410
    85 0,060752 0,060752 1 2005 10 2 0 334
    85 -0,19819 0,198193 0 2006 10 2 0 210
    85 -0,05474 0,054738 0 2007 10 2 0 210
    88 -0,00473 0,004732 0 2004 40 2 0 183
    88 0,008764 0,008764 1 2005 40 2 0 183
    88 -0,02634 0,02634 0 2006 40 2 0 183
    88 -0,02833 0,028331 0 2007 40 1 0 183
    90 -0,075 0,074999 0 2004 50 3 0 272
    90 0,085016 0,085016 1 2005 50 3 0 272
    90 -0,07688 0,076877 0 2006 50 3 0 313
    90 -0,4773 0,477299 0 2007 50 3 0 313
    92 -0,05442 0,054422 0 2007 45 3 0 214
    93 -0,00537 0,005366 0 2004 50 3 1 438
    93 -0,01186 0,011861 0 2005 50 3 1 438
    93 0,00983 0,00983 1 2006 50 3 1 438
    93 -1,8E-05 1,84E-05 0 2007 50 3 1 389
    96 -0,06039 0,060391 0 2004 50 4 0 373
    96 -0,01094 0,010942 0 2005 50 4 0 373
    96 0,046017 0,046017 1 2006 50 4 0 373
    96 -0,00231 0,002307 0 2007 50 4 0 373
    100 -0,02359 0,023592 0 2004 40 2 0 401
    100 -0,06232 0,062319 0 2005 40 2 0 401
    100 -0,03813 0,038126 0 2006 40 2 0 401
    100 -0,02652 0,026519 0 2007 40 2 0 401
    101 -0,01248 0,012482 0 2004 45 2 0 38
    101 0,027878 0,027878 1 2005 45 2 0 38
    101 0,021334 0,021334 1 2006 45 2 0 38
    101 0,050478 0,050478 1 2007 45 2 0 38
    103 0,014229 0,014229 1 2004 50 2 0 180
    103 0,014934 0,014934 1 2005 50 2 0 180
    103 -0,00063 0,000634 0 2006 50 2 0 180
    103 -0,01555 0,015549 0 2007 50 2 0 180
    104 -0,00128 0,001277 0 2004 50 1 0 149
    104 -0,01518 0,015181 0 2005 50 1 0 149
    104 -0,01774 0,017744 0 2006 50 1 0 149
    104 -0,00299 0,002994 0 2007 50 1 0 149
    108 -0,00226 0,002257 0 2005 50 2 0 360
    108 -0,00708 0,007084 0 2006 50 2 0 360
    108 -0,01661 0,016606 0 2007 50 2 0 360
    110 -0,00623 0,006226 0 2004 50 2 0 338
    110 -0,00433 0,004334 0 2005 50 2 0 338
    110 0,010965 0,010965 1 2006 50 2 0 338
    110 -0,00172 0,001721 0 2007 50 2 0 37
    113 0,029253 0,029253 1 2004 40 2 0 377
    113 -0,03528 0,035276 0 2005 40 2 0 263
    113 -0,021 0,021001 0 2006 40 2 0 263
    113 0,086148 0,086148 1 2007 40 2 0 263
    115 0,009363 0,009363 1 2004 50 2 0 166
    115 -0,01705 0,017054 0 2005 50 2 0 166
    115 0,018992 0,018992 1 2006 50 2 0 166
    119 -0,03753 0,037533 0 2004 50 2 0 100
    119 -0,02677 0,026771 0 2005 50 2 0 100
    119 -0,04398 0,04398 0 2006 50 2 0 100
    119 -0,03121 0,031208 0 2007 50 2 0 100
    120 0,006125 0,006125 1 2004 50 2 0 113
    120 -0,01482 0,01482 0 2005 50 2 0 122
    120 -0,00439 0,004392 0 2006 50 2 0 122
    120 0,000701 0,000701 1 2007 50 2 0 122
    121 0,206962 0,206962 1 2007 50 3 0 328
    122 -0,03176 0,031761 0 2004 40 2 0 59
    122 -0,01008 0,010078 0 2005 40 2 0 59
    122 -0,016 0,015997 0 2006 40 2 0 59
    122 0,029021 0,029021 1 2007 40 2 0 59
    123 -0,01285 0,012854 0 2004 40 2 0 114
    123 -0,02298 0,022984 0 2005 40 2 0 114
    123 -0,01643 0,016429 0 2006 40 2 0 114
    123 0,042742 0,042742 1 2007 40 2 0 114
    126 -0,00993 0,009928 0 2004 50 2 0 193
    126 -0,00839 0,008392 0 2005 50 2 0 193
    126 -0,00292 0,002922 0 2006 50 2 0 193
    126 0,0125 0,0125 1 2007 50 2 0 193
    127 -0,05572 0,055715 0 2004 50 2 0 251
    127 0,138872 0,138872 1 2005 50 2 0 251
    127 0,012966 0,012966 1 2006 50 2 0 358
    127 0,008048 0,008048 1 2007 50 2 0 47
    133 0,01452 0,01452 1 2004 50 1 0 119
    133 0,019027 0,019027 1 2005 50 1 0 119
    133 -0,00894 0,008941 0 2006 50 1 0 119
    133 0,001545 0,001545 1 2007 50 2 0 119













  • #2
    Hi Niels,

    If you have a panel dataset with a continuous outcome variable then you can use "xtreg" to estimate a regression regardless of whether your dependent variables are continuous or binary.
    It sounds like you want to run a fully-specified model. To run fixed-effects you use "xtreg Y X controls i.year, fe cluster(units)" where I suggest you cluster your standard errors.

    Best,
    Rhys

    Comment

    Working...
    X