Announcement

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

  • #16
    And I tried to use logitfe to estimate a logit regression but I get the error that I must -tsset- my data but I cannot do that with my dataset as my dataset can only be uniquely identified by three variables: investor, date and stock. If I just use
    Code:
    tsset bdate investor
    I get the error message "repeated time values within panel"
    Last edited by Jana He; 03 Jan 2023, 03:16.

    Comment


    • #17
      Jana:
      I think you've two options:
      1) live with that omission and move forward;
      2) share an excerpt of your dataset that allow interested listers to replicate the issue.
      As far as the -tsset- issue is concerned, didn't you experience the same nuisance when -xtset- your dataset?
      Last edited by Carlo Lazzaro; 03 Jan 2023, 05:09.
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #18
        Thank you Carlo!

        Below you find an excerpt:
        Code:
        * Example generated by -dataex-. For more info, type help dataex
        clear
        input long investor float bdate str8 cusip float(gain sell) double ybeta float(retp retm mini maxi sqrhp logprc dec)
         6002  549 "81137170" . .   2.008738949936533           .           . 0 1         . 2.9177706 0
         6002  571 "81137170" 1 1   2.080146595752337    .2837838           0 0 1  4.690416 2.9177706 0
         7109   92 "00190710" . .  1.3891114190313572           .           . 0 0         . 3.1135154 0
         7109  570 "00190710" 0 0  2.8622897768375988           0        -.15 0 0  21.86321 3.1135154 0
         7109  622 "00190710" 0 0    2.14039149765999           0         -.4 0 0  23.02173 3.1135154 0
         7109  784 "00190710" 0 0   1.555482337250436           0  -.01111111 0 0 26.305893 3.1135154 1
         7109  790 "00190710" 1 1  1.5063815172136008  .033333335           0 0 0  26.41969 3.1135154 1
         7109  200 "01849010" . .   1.168848734699765           .           . 0 0         .  1.641919 0
         7109  570 "01849010" 1 1  1.3495534096532305   .05172417           0 0 0 19.235384  1.641919 0
         7109  993 "04890310" . .   1.168119995517754           .           . 0 0         .  2.788093 0
         7109 1076 "04890310" 1 0   .9310887462663789   .16923077           0 0 1  9.110434  2.788093 0
         7109  602 "10904310" . .  1.1460435394553838           .           . 0 0         .  2.764236 0
         7109  622 "10904310" 1 0  1.0537124296626945  .026768666           0 0 0  4.472136  2.723032 0
         7109  784 "10904310" 1 0   .7933940271096872    .2619503           0 0 0 13.490738  2.723032 1
         7109  790 "10904310" 1 0   .8503623798455918    .2695984           0 0 0  13.71131  2.723032 1
         7109  794 "10904310" 1 0   .8364098500693192   .27151045           0 0 0 13.856406  2.723032 1
         7109  837 "10904310" 1 0   .7308548766855976   .28489485           0 0 0  15.32971  2.723032 0
         7109  866 "10904310" 1 0   .7915133430852629   .29636708           0 0 0 16.248077  2.723032 0
         7109  867 "10904310" 1 0    .824300590207037    .3040153           0 0 0  16.27882  2.723032 0
         7109  907 "10904310" 1 0   .8507279045076253   .12428299           0 1 0 17.464249  2.723032 0
         7109  917 "10904310" 1 1   .8349777360154119   .10898666           0 1 0  17.74824  2.723032 0
         7109  993 "10904310" . .   .8712784225491733           .           . 1 0         .         . 0
         7109 1076 "10904310" 1 0   .7765564514870518   .04954102           0 0 1  21.77154  2.764236 0
         7109  762 "22237210" . .  2.3386394545141673           .           . 0 0         . 1.5086964 0
         7109  784 "22237210" 0 0   2.357073160926547           0  -.04147465 0 0  4.690416 1.5086964 1
         7109  790 "22237210" 0 0  2.4557297878140263           0  -.11059906 1 0  5.291502 1.5086964 1
         7109  794 "22237210" 0 0   2.415436985215511           0  -.12903222 0 0  5.656854 1.5086964 1
         7109  837 "22237210" 0 0  2.5716542237493982           0 -.069124416 1 0 8.6602545 1.5086964 0
         7109  866 "22237210" 0 1  2.2716455157431845           0  -.12903222 0 0  10.19804 1.5086964 0
         7109  576 "38131710" . .  1.5175735738382674           .           . 0 0         . 2.0715983 0
         7109  622 "38131710" 0 1  1.3521886288588894           0 -.070866145 1 0   6.78233 2.0715983 0
         7109 1223 "40621610" . .  1.0220170580024623           .           . 0 0         . 2.3576627 0
         7109  711 "50025510" . .  1.7818983854204458           .           . 0 1         . 1.6341305 0
         7109  784 "50025510" 1 0   1.929669127527389    .2012195           0 0 1 8.5440035 1.6341305 1
         7109  790 "50025510" 1 0    1.95143597810984    .1890244           0 0 0  8.888194 1.6341305 1
         7109  794 "50025510" 1 1   1.987045136765144   .13719513           0 0 0  9.110434 1.6341305 1
         7109  634 "53567810" . .   1.912965024822976           .           . 0 1         . 2.3025851 0
         7109  784 "53567810" 1 0   2.385606172764154   .28099173           0 0 0  12.24745 1.3300546 1
         7109  790 "53567810" 1 0    2.37684249090268   .28099173           0 0 0 12.489996 1.3300546 1
         7109  794 "53567810" 1 0  2.3336416807993667    .2231405           0 0 0  12.64911 1.3300546 1
         7109  837 "53567810" 1 0  1.9264133368636682    .4090909           0 0 0 14.247807 1.3300546 0
         7109  866 "53567810" 1 0   1.814476771803207    .4710744           0 0 0 15.231546 1.3300546 0
         7109  867 "53567810" 1 0  1.7908965088390747    .4958678           0 0 0 15.264338 1.3300546 0
         7109  907 "53567810" 1 1   1.729254983092947    .5413223           0 0 0  16.52271 1.3300546 0
         7109 1022 "53567810" . .  1.4110863134729625           .           . 0 0         .         . 0
         7109 1076 "53567810" 1 1  1.5249419409800953   .07323232           0 0 1 21.023796  1.822531 0
         7109 1364 "53567810" . .  1.8549869616985402           .           . 1 0         .         . 0
         7109  321 "59408710" . .  1.9363836940676475           .           . 0 0         . 1.8408803 0
         7109  570 "59408710" 1 0  1.4991323256850844    .6603774           0 0 0 15.779734 1.6031682 0
         7109  622 "59408710" 1 0  1.4885346865970304     .408805           0 0 0 17.349352 1.6031682 0
         7109  731 "59408710" . .   1.288798875384194           .           . 0 1         .         . 0
         7109  784 "59408710" 1 1  1.6142445556760812   .28925616           0 1 0 21.517435 1.8408803 1
         7109  837 "80818810" . .    1.15855269017796           .           . 0 0         .  3.300456 0
         7109  866 "80818810" 1 1  1.1672740231721175   .01843318           0 0 0  5.385165  3.300456 0
         7109  842 "86693310" . .   .8380989179634359           .           . 0 0         .  2.862201 0
         7109  866 "86693310" 1 0  1.2786107053820939  .029239766           0 0 0   4.89898  3.062222 0
         7109  867 "86693310" 1 1  1.4331545574133697    .1520468           0 0 0         5  3.062222 0
         7109 1138 "86693310" . .   .9525818357719045           .           . 1 0         .         . 0
         7109  561 "87156510" . .   .9967090956658293           .           . 0 0         . 2.8857315 0
         7109  570 "87156510" 1 0  1.1202541473553498 .0046511986           0 0 0         3 2.8857315 0
         7109  622 "87156510" 0 0  1.6910980470508061           0  -.21860462 0 0   7.81025 2.8857315 0
         7109  784 "87156510" 0 0   1.525019377402321           0   -.4325581 0 0 14.933185 2.8857315 1
         7109  790 "87156510" 0 0  1.5669278953084151           0   -.4232558 0 0 15.132746 2.8857315 1
         7109  794 "87156510" 0 0  1.5596652739087804           0   -.4697674 0 0 15.264338 2.8857315 1
         7109  837 "87156510" 0 0    .942885709894134           0   -.3348837 0 0 16.613247 2.8857315 0
         7109  866 "87156510" 0 0  1.1972595123206595           0   -.3348837 0 0 17.464249 2.8857315 0
         7109  867 "87156510" 0 0  1.1124467799481126           0   -.3488372 0 0 17.492855 2.8857315 0
         7109  907 "87156510" 0 0   .6098279878030748           0   -.3116279 0 1 18.601076 2.8857315 0
         7109  917 "87156510" 0 0   .5657970660140944           0   -.3302325 1 0 18.867962 2.8857315 0
         7109  968 "87156510" 0 1   .6507206426400469           0   -.2930232 0 0  20.17424 2.8857315 0
         9573  135 "20449310" . .   .9303541332617078           .           . 1 0         .  .8685001 0
         9573  654 "20449310" 1 1  1.6439825308436744    .6713286           0 0 0  22.78157  .8685001 0
         9573 1438 "59511210" . .  .15540773424548948           .           . 1 0         . 2.3272777 0
         9573   56 "91528910" . .    .766424874888468           .           . 0 0         .  3.203762 0
         9573  654 "91528910" 1 0   1.292118877200544   .29441625           0 0 0  24.45404  3.203762 0
         9573 1130 "93204510" . .   1.808455118086764           .           . 0 0         .  2.833213 0
         9573 1178 "93204510" . .   .9008979482129524           .           . 0 0         .         . 0
         9654 1194 "17275R10" . .  2.2964160809506367           .           . 0 0         . 1.6869133 0
         9654 1198 "17275R10" 0 1  2.2167752775812626           0  -.01545248 0 0         2 1.1460788 0
         9654 1341 "17275R10" . .   2.052146521005957           .           . 0 1         .         . 0
         9654 1351 "17275R10" 0 1  1.9319636692477278           0  -.07964602 0 0 12.529964 1.7034847 0
         9654 1358 "17275R10" . .   1.739597800474795           .           . 0 0         .         . 0
         9654 1397 "17275R10" 1 0  1.6035604631721685   .12853475           0 0 0 14.247807 1.6869133 0
         9654 1409 "17275R10" 1 0  1.5281426102137012   .11825192           0 0 0 14.662878 1.6869133 0
         9654 1440 "17275R10" 1 1  1.2964178266925819  .066838056           0 1 0 15.684387 1.6869133 0
         9654  112 "19121610" . .   .9273422174421602           .           . 0 0         . 2.9177706 0
         9654  117 "19121610" 1 1    .935197151566557 .0023094688           0 0 0  2.236068 1.9118546 0
         9654  296 "19121610" . .   .8749554403478907           .           . 0 0         .         . 0
         9654  336 "19121610" 0 0   .8036742057896199           0 -.018072288 0 0  14.96663  2.339399 0
         9654  338 "19121610" 0 1   .8064051494175437           0 -.031626508 0 0 15.033297  2.339399 0
         9654 1093 "19121610" . .   .5052500934551555           .           . 0 1         .         . 0
         9654 1114 "19121610" 1 1   .4593668141814874   .02714932           0 0 0  31.65438  2.625574 0
         9654 1156 "19121610" . .   .4524988049455217           .           . 0 1         .         . 0
         9654 1170 "19121610" 1 0  .40466322001593386   .02636917           0 0 1 32.326458  2.734773 0
         9654 1174 "19121610" 1 0   .3496003912396076   .06693712           0 0 1 32.326458  2.734773 0
         9654 1186 "19121610" 1 0  .30128315314071424   .04868154           0 0 0 32.326458  2.734773 0
         9654 1189 "19121610" 1 0  .29370285974450355   .04665314           0 0 0 32.326458  2.734773 0
         9654 1198 "19121610" 1 0   .2361166767207053   .06490872           0 0 0 32.326458  2.734773 0
         9654 1206 "19121610" 1 0  .20325226055850296    .0831643           0 0 1 32.326458  2.734773 0
         9654 1218 "19121610" 1 0   .2498694268548907   .05070994           0 0 0 32.326458  2.734773 0
         9654 1223 "19121610" 1 0  .23533876336310597   .03448276           0 0 0 32.326458  2.734773 0
         9654 1243 "19121610" 1 1  .15737913952349117   .15010142           0 0 1 32.326458  2.734773 0
         9654 1273 "19121610" . .  .18240330936835827           .           . 0 1         .         . 0
         9654 1192 "26864810" . .  2.3377638329130805           .           . 0 0         .  .9889327 0
         9654 1198 "26864810" 1 0  2.3302253427478936   .03977273           0 0 0   2.44949  .9889327 0
         9654 1206 "26864810" 0 1  2.3664478030095992           0   -.0965909 0 0 3.7416575  .9889327 0
         9654  112 "47816010" . .   .9500290093180779           .           . 0 0         . 2.4952695 0
         9654  117 "47816010" 0 1   .9476932299786285           0 -.005154639 0 0  2.236068 2.4952695 0
         9654 1186 "50216110" . .  2.3852920561447797           .           . 0 0         .  3.175446 0
         9654 1189 "50216110" 0 1   2.380197326087056           0 -.028720627 0 0 1.7320508  3.175446 0
         9654  842 "55267310" . .  1.4320082658529347           .           . 0 0         . 3.2724166 0
         9654  848 "55267310" 0 1  1.4223161961959054           0  -.07109005 1 0   2.44949 3.2724166 0
         9654 1156 "58013510" . .   .6768094070951254           .           . 0 1         .  2.938267 0
         9654 1170 "58013510" 0 1   .5920357601849466           0  -.01320138 0 0 3.7416575  2.938267 0
         9654 1423 "59491810" . .   .9799206300365183           .           . 0 0         .  2.029381 0
         9654 1201 "69489010" . .   .5901569145740198           .           . 0 1         .  3.371597 0
         9654 1206 "69489010" 0 0   .6067449004786676           0 -.017167382 0 0  2.236068  3.371597 0
         9654 1218 "69489010" 0 1   .6164570850892505           0  -.02145923 0 0 4.1231055  3.371597 0
         9654  308 "74790610" . .   2.258527035642426           .           . 0 1         . 2.0715983 0
         9654  318 "74790610" . .   2.243030055296173           .           . 0 1         .         . 0
         9654  336 "74790610" 1 0   2.401233437861352   .09448819           0 0 0  5.291502 2.0715983 0
         9654  338 "74790610" 1 1   2.389140380239708   .07874016           0 0 0  5.477226 2.0715983 0
         9654 1397 "74955310" . .  2.8085511928003606           .           . 0 1         .  1.954799 0
         9654 1409 "74955310" 1 0   2.631227578595788    .0619469           0 0 0 3.4641016  1.954799 0
         9654 1440 "74955310" 0 0  2.6440099709256817           0   -.3628319 1 0  6.557438  1.954799 0
         9654  296 "80851310" . .  1.9076201258222278           .           . 0 0         . 1.0216513 0
         9654  336 "80851310" . .  2.1704979019736257           .           . 0 0         .         . 0
         9654  338 "80851310" 1 0  2.1556662055059097   .06249996           0 0 0  6.480741 .05211608 0
         9654  342 "80851310" . .  2.1380761544194864           .           . 0 0         .         . 0
         9654  352 "80851310" . .  2.1391782901332537           .           . 0 1         .         . 0
         9654  410 "80851310" 0 1  2.3782446633571244           0   -.3511521 1 0 10.677078 .10997948 0
         9654 1170 "80851310" . .  2.6842090439024493           .           . 0 1         .         . 0
         9654 1174 "80851310" 1 1   2.837501342325611   .05230773           0 0 0 29.631065  1.101694 0
         9654 1233 "80851310" . .   2.930935611480286           .           . 0 1         .         . 0
         9654 1243 "80851310" 0 1   3.163270538647763           0  -.06926403 0 0 30.773365 1.4534336 0
         9654 1297 "80851310" . .   3.163270538647763           .           . 0 0         .         . 1
         9654 1174 "81185010" . .    1.16499634976665           .           . 0 0         .  3.604138 0
         9654 1186 "81185010" 1 1  1.1570332538852766   .07335907           0 0 0 3.4641016 3.4773865 0
         9654 1192 "81185010" . .  1.1029075895957288           .           . 0 1         .         . 0
         9654 1198 "81185010" 0 0  1.0725942609993497           0 -.020408163 0 0   4.89898  3.604138 0
         9654 1206 "81185010" 1 0  1.0543123869325317  .017006803           0 0 0  5.656854  3.604138 0
         9654 1218 "81185010" 0 0  1.0506622720839152           0           0 0 0   6.63325  3.604138 0
         9654 1223 "81185010" 0 1  1.0251560765453513           0 -.010204081 0 0         7  3.604138 0
         9654 1403 "90338F10" . .  2.3090129214401753           .           . 0 1         . 4.0386558 0
         9654 1409 "90338F10" 0 1    2.24569852356466           0  -.08478803 0 0   2.44949 4.0386558 0
         9654  205 "92829810" . .  1.7124347122927748           .           . 0 0         . 1.2266504 0
         9654  211 "92829810" 0 1  1.6954939778260831           0   -.0745342 1 0   2.44949 1.2266504 0
        13974 1291 "02082510" . .  1.7269531590639162           .           . 0 0         . 1.5581446 1
        13974 1332 "02082510" 0 1  1.4790247537185024           0   -.2105263 0 0  6.403124 1.5581446 0
        13974 1282 "02127110" . .     .31455568304677           .           . 0 1         .  .4054651 0
        13974 1290 "02127110" 1 0   .2723687999775622   .14583333           0 0 1  2.828427  .4054651 1
        13974  812 "02209210" . .  2.8127554455735937           .           . 0 0         . 1.9848255 0
        13974  819 "02209210" 1 0  2.9474228944573837  .022900807           0 0 0  2.645751 1.9848255 0
        13974  823 "02209210" 0 1   2.898839613875046           0  -.08396947 0 0  3.316625 1.9848255 0
        13974 1213 "02790410" . .   .3964984416623803           .           . 0 0         .  1.417066 0
        13974 1257 "02790410" 0 0 -.03277495851246775           0   -.1969697 1 0   6.63325  1.417066 0
        13974 1258 "02790410" 0 1 -.06478543027349519           0   -.1818182 0 0  6.708204  1.417066 0
        13974 1119 "03819610" . .   1.322065084105085           .           . 0 0         . 2.6300886 0
        13974 1141 "03819610" 1 0  1.0914044583835618   .15315315           0 0 0  4.690416 2.6300886 0
        13974 1151 "03819610" 1 1   .9356298357665795    .0990991           0 0 0  5.656854 2.6300886 0
        13974 1060 "17002110" . .  .33793014620611705           .           . 0 0         . 2.1400661 0
        13974 1078 "17002110" 0 1  .25174110994943516           0  -.20588236 0 0 4.2426405 2.1400661 0
        13974  651 "19906410" . .   .4916547709030636           .           . 0 0         .  1.933273 0
        13974  715 "19906410" 0 1   .7273080212176378           0   -.1195652 0 0         8  1.933273 0
        13974  804 "26864810" . .   2.688272687323979           .           . 0 1         .  .8290841 0
        13974  812 "26864810" 1 1  2.5946905209280136   .06666663           0 0 0  2.828427  .8290841 0
        13974  819 "28233010" . .  .16502872498961407           .           . 0 0         . 2.2512918 0
        13974  823 "28233010" 1 0  .13594588402067284   .07894737           0 0 0         2 2.2512918 0
        13974  827 "28233010" 1 0  .40652544440777333   .11842106           0 0 1  2.828427 2.2512918 0
        13974  830 "28233010" 1 1  .28115117410768947   .03947368           0 0 0  3.316625 2.2512918 0
        13974   78 "33715710" . .  2.1125324502776968           .           . 0 0         .    1.7492 0
        13974  197 "33715710" 1 1  2.2423342256049694   .59420294           0 0 0 10.908712    1.7492 0
        13974 1258 "53945110" . .   1.732927248746239           .           . 0 0         . 2.7647455 0
        13974 1290 "53945110" 0 1  1.3064630024885564           0   -.3228346 0 0  5.656854 2.7647455 1
        13974  335 "58504010" . .    .526515381060392           .           . 0 0         .  .3184537 0
        13974  351 "58504010" 1 1   .4861502143088932    .1818182           0 0 0         4  .3184537 0
        13974  960 "66990810" . .  2.1966150067099157           .           . 0 0         .  1.491655 0
        13974 1020 "66990810" 1 1   1.209187447158009    .0892857           0 0 0  7.745967  1.491655 0
        13974  852 "67061Y10" . .  .11434529925906012           .           . 0 0         .   1.58412 0
        13974  876 "67061Y10" 0 1  1.5632263270318016           0  -.23076923 0 0   4.89898   1.58412 0
        13974  741 "78465210" . .  .21912790168359816           .           . 0 0         .  2.564949 0
        13974  794 "78465210" 0 1   .6408276139103182           0   -.3269231 1 0   7.28011  2.564949 1
        13974  351 "85928110" . .  1.0908180203596827           .           . 0 0         . 2.3338375 0
        13974  595 "85928110" 1 1  1.3462519208831119   .21621627           0 1 0   15.6205  1.433896 0
        13974  804 "85928110" . .   2.149528443148383           .           . 0 1         .         . 0
        13974  812 "85928110" 0 0  2.2794600344750084           0           0 0 0  21.47091 2.3338375 0
        13974  819 "85928110" 0 0    2.17731612738665           0  -.06593407 0 0  21.63331 2.3338375 0
        13974  823 "85928110" 0 0  2.2665603227207565           0 -.010988995 0 0  21.72556 2.3338375 0
        13974  827 "85928110" 0 1   2.232522139569679           0  -.09890106 0 0 21.817425 2.3338375 0
        13974 1228 "87156610" . .  1.4565556349401154           .           . 0 0         . 1.4759065 0
        13974 1257 "87156610" 0 1   .5802435659494697           0  -.17142858 1 0  5.385165 1.4759065 0
        13974 1078 "97652410" . .  1.7684937819127684           .           . 0 1         .  1.446919 0
        13974 1119 "97652410" 1 0  2.4846206491700027    .3529412           0 0 0  6.403124  1.446919 0
        13974 1141 "97652410" 1 1   2.223859569101908    .3921568           0 0 0  7.937254  1.446919 0
        15686  290 "02581610" . .    1.81506957237944           .           . 0 1         . 1.6832637 1
        15686  490 "02581610" 0 0   1.359453561810186           0 -.012048183 1 0 14.142136 1.6832637 0
        15686  569 "02581610" 1 0   1.205020280227655   .18674693           0 0 0 16.703293 1.6832637 0
        15686  662 "02581610" 1 1  1.1557254535295471   .43373495           0 0 1   19.2873 1.6832637 0
        15686  600 "09702310" . .   .5489855525375167           .           . 0 0         .  2.847812 0
        15686  662 "09702310" 1 0   .5472530136088719   .14130434           0 0 0  7.874008  2.847812 0
        end
        format %tbBusinessMA bdate

        And for my original regression I just used -xtset investor- and did not include date.

        Comment


        • #19
          That is very odd. It suggests that there is a colinearity among the bdate indicators themselves, which is very difficult to explain. Please post example data, using the -dataex- command. Be sure to include data from several investors and the full range of values of bdate, and all of the variables that are used in the regression. I'll try to figure out what is going on.

          Comment


          • #20
            My bdate variable ranges from January 2, 1991 to November 29, 1996. Is the data example I posted not large enough? And thank you for helping me out!

            Comment


            • #21
              Oh, sorry, I somehow didn't notice you already posted an example. Yes, it illustrates the problem, so it is sufficient. I'll try to figure it out. I'll post back later with whatever I find.

              Comment


              • #22
                OK, I've figured it out.

                The colinearity is arising between the bdates and the investor fixed-effects. Each investor is observed only on certain dates, and so defines a subset of the dates (just like dec defines a subset of the dates). In fact, this occurs to the extreme: there are several dates that correspond to one and only one investor, so that investor's fixed effect indicator is equal to that date's date indicator. You can confirm this by noticing that if you go from -xtreg- to just -regress- (and don't add any i.investor variables) all of the bdate omissions are eliminated.

                So, on the assumption that the effects of the specific dates are included only to adjust for their confounding effects, this is not a problem. You can just leave it as it is. In the unlikely situation that you actually need estimates of the date effects, however, you are in deep trouble because they are rather severely confounded by the investor effects.
                Last edited by Clyde Schechter; 03 Jan 2023, 11:08.

                Comment


                • #23
                  Thank you so much Clyde! I would have not figured it out by myself!

                  Comment


                  • #24
                    Maybe back to my post #16. I still have not figured out how to implement a logit or probit regression with my dataset. I want a logit/probit regression with investor- and time-fixed effects and robust standard errors clustered at the investor level. Can someone help me with that?

                    Comment


                    • #25
                      Try using egen combined with the group function and then use the resulting group to xtset the data

                      Comment


                      • #26
                        But then I cannot include investor-fixed effect, right? And I just run the logitfe regression and this is what I get:

                        Code:
                        .         logitfe sell i.gain##c.ybeta retp retm mini maxi sqrhp logprc, nocorrection
                        Warning: time variable dates has 497741 gap(s) in relevant range
                        
                        Computing uncorrected fixed effects estimator
                        
                        note: multiple positive outcomes within groups encountered
                        note: multiple positive outcomes within time periods encountered
                        note: 127688 groups and 34 time periods (286580 obs) dropped because
                              of all positive or all zero outcomes
                                             J():  3900  unable to allocate real <tmp>[467919,82241]
                                         logit():     -  function returned error
                                         <istmt>:     -  function returned error
                        r(3900);
                        
                        end of do-file
                        
                        r(3900);
                        I am not familiar with logitfe, so maybe I did not applied it correctly...

                        Comment


                        • #27
                          Jana:
                          going -xtlogit- with your excerpt, gives back some more details about dates omission (along with a lack of convergence of the MLE):
                          Code:
                          . xtlogit sell i.gain##c.ybeta retp retm mini maxi sqrhp logprc i.dec##i.gain i.bdate, fe
                          note: 1290.bdate omitted because of collinearity.
                          note: multiple positive outcomes within groups encountered.
                          note: 1 group (1 obs) omitted because of all positive or
                                all negative outcomes.
                          note: 571.bdate omitted because of no within-group variance.
                          note: 654.bdate omitted because of no within-group variance.
                          In addition:
                          1) if -xtset- complains about "repeated time values within panel", -tsset- does it either:
                          2) if you have installed the last updated version of the community-contributed module -logitfe-, the errot -r(3900)- is due to your operating system refusing to supply more memory.
                          Kind regards,
                          Carlo
                          (Stata 19.0)

                          Comment


                          • #28
                            I used -xtset- as Maxence suggested with date and stock-investor combined but I wondered whether including investorfixed effects is then possible. And Carlo, I am not quiet sure whether I got your points. Does that mean that implementing a logit regression with my data is not possible?
                            And yes, I installed the last updated version of -logitfe-.

                            Again, thank you for your time and help!

                            Comment


                            • #29
                              Jana:
                              1) it is possible that you experience collinearity issues within fixed effects and -investorfixed-, as investor enters the -stock-investor- new -panelid- (by the way: if you want to stick with linera probability model, have you already taken a look at the community-contributed module -reghdfe-?);
                              2) no, I meant that, theoretically speaking, -xtlogit- is possible. However:
                              a) it shares most of the collinearity issues with -xtreg,fe-;
                              b) cluster-ronust standard error is not an available option (but you can go -bootstrap-);
                              c) it does not seem to converge when applied to your data excerpt (but this might not hold for your whole dataset);
                              d) the fixed effect estimator of -xtlogit- is a conditional one (but ethe community-contributed module -logitfe- seels to handle the incidental paraneters bias; see, if interested, http://www.econ.brown.edu/Faculty/To...meters1948.pdf).
                              Kind regards,
                              Carlo
                              (Stata 19.0)

                              Comment


                              • #30
                                My problem is that I do not know how to implement the -logitfe- regression model in Stata as I am not familiar with the module and reading the explanations of -logitfe- confuses me.

                                And I just run my regression with -reghdfe- and the coefficients I get are the same as for -xtreg,fe- except for the constant and also the within R2 is slightly different and with -reghdfe- standard errors are clustered for 31,758 investors whereas with -xtreg, fe- it is clustered for 43,003 investors.

                                Comment

                                Working...
                                X