Announcement

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

  • Error message in running logistic regression

    Dear Statalisters

    I'm trying to run a logistic regression on some financial crisis dummy variables using some crisis predictors. Here's an example of my dataset:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float Yr str2 A2 str52 Cty double(CA Inf Sav Cred EXg FDI FX) float FX_gdp double(M2_R Int GExp GDPg) float(REERov Debt CGap RPp PpGr) double(A_DSR H_DSR) float(Share CDum)
    1970 "AO" "Angola"          .       .      .                .                  .                  .                .          .                .                .                .                  .         .         .         . . . . .        . 1
    1971 "AO" "Angola"          .       .      .                .                  .                  .                .          .                .                .                .                  .         .         .         . . . . .        . 0
    1972 "AO" "Angola"          .       .      .                .                  .                  .                .          .                .                .                .                  .         .         .         . . . . .        . 1
    1973 "AO" "Angola"          .       .      .                .                  .                  .                .          .                .                .                .                  .         .         .         . . . . .        . 1
    1974 "AO" "Angola"          .       .      .                .                  .                  .                .          .                .                .                .                  .         .         .         . . . . .        . 0
    1975 "AO" "Angola"          .       .      .                .                  .                  .                .          .                .                .                .                  .         .         .         . . . . .        . 0
    1976 "AO" "Angola"          .       .      .                .                  .                  .                .          .                .                .                .                  .         .         .         . . . . .        . 0
    1977 "AO" "Angola"          .       .      .                .                  .                  .                .          .                .                .                .                  .         .         .         . . . . .        . 0
    1978 "AO" "Angola"          .       .      .                .                  .                  .                .          .                .                .                .                  .         .         .         . . . . .        . 0
    1979 "AO" "Angola"          .       .      .                .                  .                  .                .          .                .                .                .                  .         .         .         . . . . .        . 0
    1980 "AO" "Angola"      1.176  46.708 19.808                .                  .   .630975103981031                .          .                .                .                .                  .         .         .         . . . . .        . 0
    1981 "AO" "Angola"     -3.297   1.391   16.9                .                  .    .88370687168445                .          .                .                .                .  -4.40000121936167         .         .         . . . . .        . 0
    1982 "AO" "Angola"     -8.904   1.833 13.894                .                  .   2.08648507257444                .          .                .                .                .                  0         .         .         . . . . .        . 0
    1983 "AO" "Angola"     -6.208   1.833 12.825                .                  .   1.80366249575565                .          .                .                .                .   4.20000142834158         .         .         . . . . .        . 0
    1984 "AO" "Angola"     -2.784   1.833 16.153                .                  .   1.09500567621391                .          .                .                .                .   6.00000216437296         .         .         . . . . .        . 0
    1985 "AO" "Angola"       2.58   1.833 13.189                .                  .   3.68038359532726                .          .                .                . 44.2472924841214   3.49999948953456         .         .         . . . . .        . 0
    1986 "AO" "Angola"     -4.282   1.833  6.053                .                  .   3.30879389182255                .          .                .                .  47.259842369146   2.90000174265124         .         .         . . . . .        . 0
    1987 "AO" "Angola"      5.526   1.833 15.831                .                  .   1.47206684886135                .          .                .                .  41.344617828533    4.0827486364886         .         .         . . . . .        . 0
    1988 "AO" "Angola"     -5.345   1.833  2.999                .                  .   1.49385627947356                .          .                .                . 38.1132454860176   6.12889047620008         .         .         . . . . .        . 0
    1989 "AO" "Angola"     -1.293   1.833 10.169                .                  .   1.96057306398349                .          .                .                . 32.7635872991894  .0416214618443149         . 3.5530245         . . . . .        . 0
    1990 "AO" "Angola"     -2.096   1.833  6.181                .                  .  -2.98162799825608                .          .                .                . 29.7650364957297  -3.45009868360491         .  2.910154         . . . . .        . 0
    1991 "AO" "Angola"     -5.322  85.265 12.726                .                  .   6.26663053571429                .          .                .                . 57.1428571428571   .991359291928845         .  2.805627         . . . . .        . 1
    1992 "AO" "Angola"      -8.75 299.097 16.656                .                  .   3.46608752793541                .          .                .                . 28.9473684210526  -5.83828072869944         .   2.36374         . . . . .        . 1
    1993 "AO" "Angola"    -10.968 1379.48 16.154                .                  .    5.2368632542517                .          .                .                . 38.0952380952381  -23.9834174287564         .  1.709779         . . . . .        . 1
    1994 "AO" "Angola"     -7.657 949.771 18.051                .                  .   3.83703655802979                .          .                .                . 36.6760064887185   1.33936343697863         .  1.621998         . . . . .        . 1
    1995 "AO" "Angola"     -5.327 2672.23  15.37 4.78521241666833                  .   8.52948883994992 212833268.875582 .010103964 9.49537005184752           206.25                .   15.0000000268975         . 1.8313553         . . . . .        . 1
    1996 "AO" "Angola"      49.98 4146.01 30.248 3.17745379075588                  .   2.39899396705538 551619183.828982 .023063544 3.76276143017257          217.875                .   13.5443697525014         .  2.267948         . . . . .        . 1
    1997 "AO" "Angola"    -11.511 221.492  13.96 5.16969314156703                  .   5.38231807584834 396431041.719761 .015451076 4.36322425674848            37.75                .   7.27427734536784         . 2.5790594         . . . . .        . 1
    1998 "AO" "Angola"    -28.697 107.429  6.373 3.52275914782064                  .   17.1215906483088 203453699.520865 .007574373 7.81470243709947               45                .   4.69114644457451         .  2.490785         . . . . .        . 1
    1999 "AO" "Angola"    -27.798 248.248   .098 2.57338628868441                  .   40.1672509619126 496103867.963957 .018075133 2.83388877866377 80.2966666666667                .   2.18148973162356         . 2.5715504         . . . . .        . 1
    2000 "AO" "Angola"      8.715 325.029 39.208 2.01364344107582                  .   9.62386631013722 1198212373.92884  .04236188 1.31666536679812 103.160174166667 31.5271993681416   3.05462423372167         . 2.8970394         . . . . .        . 1
    2001 "AO" "Angola"    -16.013 152.586  14.48 3.78128722413993  80.75298883019943   24.0091170615715 731866868.535283  .02483023 2.58066176012295 95.9665608333333 25.1546327243358   4.20599855394094         .  3.358223         . . . . .        . 1
    2002 "AO" "Angola"     -1.201 108.893 29.291 4.33009581727689  150.0078228597237   13.9509918914003 375545950.830607   .0112094 6.53267607056556 97.3358333333333 26.8525299005506   13.6656865110139         .  3.677767         . . . . .        . 1
    2003 "AO" "Angola"     -5.071  98.219 25.376 5.13251719256109 -1.931302168711028   25.2095604795772 634199422.648887  .01810524 3.79408349433033           96.115 27.6595640135433   4.55404242325068         .  3.849348         . . . . .        . 1
    2004 "AO" "Angola"      3.468  43.525 34.362 5.46670472037998   13.5372293706908   11.1870280681404 1374045539.67759 .035583355 2.32318478501772 82.3341666666667 19.9052376596272   10.2383565294963         . 3.9459176         . . . . .        . 1
    2005 "AO" "Angola"     18.198  22.961 45.754  5.6240010455418  28.14795833262824  -4.61801443579378 3196850749.33725  .06847256 1.53809658801234 67.7181307369684 19.9844361796852   20.9070270373719         .  3.819388         . . . . .        . 1
    2006 "AO" "Angola"      25.58  13.305 48.881 8.14961322422727  14.25466852042942 -.0902496514951315 8598584120.55047  .15477978  .99134133667712 19.5108144527911 18.4515234788259   18.9890352018358         .  5.616875         . . . . .        . 0
    2007 "AO" "Angola"     17.504  12.249 43.235 10.6219623331495  17.50085857318346  -1.47784622637735 11196800894.8434    .163609 1.19185359386099 17.6988356005955 15.2777736262089   23.1895972587248         .  5.735682         . . . . .        . 0
    2008 "AO" "Angola"      8.546  12.465 39.351 12.6825096100229  10.10467209348403   1.99454762570202 17869411575.2953   .2294119 1.56176471671852  12.533605759663 17.1322334758876   13.8170977062242         .  5.024797         . . . . .        . 0
    2009 "AO" "Angola"     -10.03  13.721 32.744 21.4688928270911 -2.639998672726179   2.92121934269443 13664098011.0068     .17129 2.34671991259274  15.682074235437 17.5047065394397   2.41290970138972         . 4.6885185         . . . . .        . 1
    2010 "AO" "Angola"      9.095   14.48 37.293 20.2023496898832 -19.50909388825168    -3.910531911354 19749472846.5552   .2393117 1.47553639749891 22.5435720221269  17.646717575811   3.45287464846986         .   4.86906         . . . . .        . 1
    1970 "AR" "Argentina"       .       .      . 17.5387441024278  1.200104116465653   .284224297397444        681788410 .004034251 10.6530970356959                . 9.74254326207249   3.04564331900328         .  28.67718         . . . . .        . 1
    1971 "AR" "Argentina"       .       .      . 18.0216983735412 -9.930944205000984   .377464477473511 304314527.124964 .001700081 19.7164426443157                . 10.1462160701663   5.65813108318036         .  28.17157         . . . . .        . 1
    1972 "AR" "Argentina"       .       .      . 17.6345260412367  2.029586086500345   .206489502469194 572449755.175402 .003145328 13.7566659087032                .  9.3516969606052   1.62841651625511         .  26.40062         . . . . .        . 0
    1973 "AR" "Argentina"       .       .      .  16.705575724589  13.97858998813466   .190792478260042 1597255505.79734 .008541473 7.65201441404247                . 11.5393235681285   2.81175404095775         . 25.357105         . . . . .        . 0
    1974 "AR" "Argentina"       .       .      . 19.1738082781793  .2357384418807129  .0247388145324033 1889579481.31192 .009591774 9.99634520227319                . 13.1532327349931   5.53380439483222         . 25.261154         . . . . .        . 1
    1975 "AR" "Argentina"       .       .      . 16.4413498377265 -9.294158523004853   .106009598269524  848224746.10848 .004305709 13.7011111561638                . 12.5891776401825 -.0284121027670921         . 24.931753         . . . . .        . 1
    1976 "AR" "Argentina"       .       .      . 13.5627672951483  31.51765655332554   .478175476645854 1983316224.28095  .01027625 4.91600893311085                . 9.42009472794214  -2.01825151667566         .  20.31233         . . . . .        . 1
    1977 "AR" "Argentina"       .       .      . 18.3829098551981  27.31777193583665   .253605959289195 3843942355.42708 .018659914 3.31950869646452                . 9.01540997694691   6.93414775537975         . 17.643436         . . . . .        . 1
    1978 "AR" "Argentina"       .       .      . 20.5571174145344  8.907269916694105   .430419501184104 5933322541.78131  .03011839  2.4023804737753                . 11.1661116653801  -4.50612480247693         . 14.584322         . . . . .        . 1
    1979 "AR" "Argentina"       .       .      . 24.0562276271982 -3.200500136420715   .297462920183783  11626505760.127  .05357837 1.54078779321729                . 11.0078459556516   10.2227634648727         . 10.247047         . . . . .        . 1
    1980 "AR" "Argentina"  -1.136       . 21.401 25.3957927507699 -5.142862404321008   .880955110053283 9296756057.32018  .04113609 2.06592634777499                .                .   4.15176234244557         .  8.271583         . . . . .        . 1
    1981 "AR" "Argentina"  -3.109       . 18.789 33.5523067783184  5.203906510014122   1.06384544018918 5006226776.17427  .02350341 3.67931279388644                .                .  -5.68952800019454         .  5.948149         . . . . .        . 1
    1982 "AR" "Argentina"  -3.193       .  17.89 33.9063722686191  3.946552407312097   .269252481027722 4503960609.47172    .022187 3.97635291571011                .                .  -4.95717851904021         . 4.6360793         . . . . .        . 1
    1983 "AR" "Argentina"  -2.161       . 17.493 28.1182756416111  2.582605848065597   .177920358938206 2840273965.03204 .013461014 7.69735006294716                .                .   3.87512342400915         .   4.57618         . . . . .        . 1
    1984 "AR" "Argentina"  -1.971       . 16.818 25.0009988367976 -2.591497770724558   .338845892416111 2590505132.02895  .01204886 6.70922833704266                .                .   2.21177350377243         . 4.3823175      38.8 . . . .        . 1
    1985 "AR" "Argentina"   -.996       . 17.783 17.3641413760603  15.55402384624856   1.03939676921859       4702644000 .023631377 3.25328837418979                .                .  -7.58667718413531         .  3.890006    43.775 . . . .        . 1
    1986 "AR" "Argentina"  -2.487       . 16.725 16.9072294948969 -10.27034118701489    .51742270994039       4427405700 .020592585 4.90721304441714                .                .   7.87577983041486         . 4.0806136      36.2 . . . .        . 1
    1987 "AR" "Argentina"  -3.593       .  14.99 21.2973148810876 -3.481999171020078 -.0171007571834998       3733969300 .016895788 6.56187102459852                .  4.7144944990421   2.90999313057101         . 3.7634535    39.175 . . . .        . 1
    1988 "AR" "Argentina"  -1.139       . 16.056 20.3358354792818  18.71956560926603   .908825708058126 5157480786.56928  .02398828 6.15377813176457                . 4.32191028434568  -2.55690487694625         .  3.643126      36.3 . . . .        . 1
    1989 "AR" "Argentina"   1.236       . 15.545 39.7174950191489  7.430323721229186   1.34139040897869 3216875257.73386 .016165202 4.78961219497491                . 4.49439596541391  -7.49618958372476         . 3.0363865    42.425 . . . .        . 1
    1990 "AR" "Argentina"   3.045       . 15.958 15.6016948142115  18.01160325298498    1.2988816648031 6222040362.99099 .032072373 2.60827611746939                . 3.13542839161188  -2.39895921890088         .  3.105113    32.025 . . . .        . 1
    1991 "AR" "Argentina"   -.209       . 13.294 12.5872034907184 -3.624144360070687   1.28557885422783 7462543636.08691 .034075543 2.68384584459823                . 3.32176128752774   12.6697100915969         .  3.334735     25.05 . . . .        . 1
    1992 "AR" "Argentina"  -2.608       .   12.8 15.4453354474077  -1.02969443918937   1.93671240172489 11447031156.7334  .04672258 2.73646934296681                . 2.97553802761558   11.9407747322281         .  3.571135    23.725 . . . .        . 1
    1993 "AR" "Argentina"  -3.137       . 14.439 18.2846049267413  3.983198679112391   1.17980281165114  15499431243.972   .0596132 2.93549471476211                . 13.5103788111334   5.90691949180228         .  4.019703    27.825 . . . .        . 0
    1994 "AR" "Argentina"  -3.934       . 14.425  20.280577998757  15.29556898178628     1.411953029158 16003265704.6277   .0581937 3.34125752748938 10.0591666666667  13.186859073959   5.83620070368526         .  3.662074     30.55 . . . .        . 0
    1995 "AR" "Argentina"  -1.822       . 18.193 19.9606075608912  22.52814468619231   2.17392758974997 15979453701.6387  .05984814 3.25235618002825 17.8466666666667 13.3495199718639  -2.84520961057081         .  2.703164    31.075 . . . .        . 0
    1996 "AR" "Argentina"  -2.425       . 15.518 20.1870018252819  7.646794889276578   2.55320340608332 19719017345.3261  .06992559 3.13160052139397 10.5108333333333 12.5016649840759   5.52668982715234         . 2.5372145      32.6 . . . .        . 0
    1997 "AR" "Argentina"   -3.87       . 15.119 21.9334587634322  12.17744082389052   3.12787793868196 22424600099.0314 .073523276 3.45693201473628           9.2425 12.0620332651549    8.1110467707457         .  2.378141      35.6 . . . .        . 0
    1998 "AR" "Argentina"  -4.515    .925 14.607 24.1532987732827  10.62339306313558   2.43876896154487 24855741233.4198   .0786574 3.44591296616969           10.635 12.4948047028206   3.85017885156229         . 2.2331445      38.9 . . . .        . 0
    1999 "AR" "Argentina"  -3.931  -1.167 12.098 24.8933437498898 -1.260277938807306   8.46058217133806 26350163675.3936  .08611164 3.38328289335259            11.04 13.7232252762562   -3.3854570406327         .    2.0143      40.5 . . . .        . 0
    2000 "AR" "Argentina"  -2.964   -.939 12.833 23.8947336198062  2.702391308604547   3.66579059535379 25152121061.9673   .0830103 3.59870148322395 11.0855177240768 13.7842129106319   -.78899893905691         . 2.0191529        38 . . . .        . 0
    2001 "AR" "Argentina"  -1.355  -1.065 12.692  20.833574652466  2.740990760172537   .806164134759348 14555552706.0021  .05019156 5.00992909530188 27.7054264197308 14.1562932934619  -4.40883968258557         . 1.8997716      35.6 . . . .        . 0
    2002 "AR" "Argentina"   7.929  25.869 18.235 15.3318584042485  3.092955185874956   2.19895819502207 10492425074.9269  .04066831  2.6010622367816         51.67878 12.2352677714505  -10.8944848285903         .   1.73948    64.125 . . . .        . 1
    2003 "AR" "Argentina"   5.771  13.443 19.054 10.7627059172487  5.995368202196659   1.29481086883944 14157285635.1056   .0503818 2.71300985963392 19.1462485849518 11.4381253998635   8.83704079576924         .  1.719257    40.675 . . . .        . 0
    2004 "AR" "Argentina"   1.798   4.416  19.35 9.68251819633223  8.114157989519825    2.5050175164097 19659594527.6289  .06424704 2.37240006102517 6.77657874174753  11.114636067696   9.02957330068155         . 1.8214326      32.5 . . . .        . 0
    2005 "AR" "Argentina"   2.473   9.642 21.362 10.6534929189359  12.88683042270884   2.64935441452167 28081718501.5579    .084077 2.02853077465431 6.16324166666666 12.1418612359575   8.85165992013435         . 2.5537415    26.875 . . . .        . 0
    2006 "AR" "Argentina"   2.791  10.898 21.471 11.9102616607561   5.56120323520517    2.3810651968205 32022294209.3513  .08895082 2.03706232748769 8.62691666666666 12.4294153726307   8.04715150043027         .  3.027214      24.1 . . . .        . 0
    2007 "AR" "Argentina"     2.1    8.83 22.199 13.0985413493544  8.164451917191414   2.25129153609907  46149458458.068  .11742865  1.7360639403055 11.0520333333333 12.9893238963619   9.00765087504757         . 3.2528255     22.45 . . . .        . 0
    2008 "AR" "Argentina"   1.492   8.585 21.065  12.313946714342  .7398744687388899   2.68990286531228 46385377923.3158  .11341168 1.83125086650914 19.4681583333333 13.6335132595631   4.05723310346406         .  3.152163      20.4 . . . .        . 0
    2009 "AR" "Argentina"   2.167    6.27  18.22 12.4162075416805   -9.3471064312958   1.20643922647566  48006987572.796  .12469348 1.75638523900066           15.655  15.903896746884  -5.91852507634947         .  2.879686    20.325 . . . .        . 0
    2010 "AR" "Argentina"   -.382  10.461 17.323 12.6901062454749  13.89691362347843   2.67516171886537 52207540131.5731    .123131 2.05397996538899          10.5575 15.1637178886417   10.1253981561002         .  3.348041    18.625 . . . .        . 0
    1970 "AT" "Austria"         .       .      .                .  10.96120300147874   .732802990777067 1805764300.19479  .01236825                .                . 14.3153976502541   6.32114254507779         .         .      47.8 . . . . 11.55244 0
    1971 "AT" "Austria"         .       .      .                .  6.408083663770768   .799230381998008 2455021251.70296 .015941696                .                .  14.393009971543   5.11496871403365         .         .    50.375 . . . . 11.73396 0
    1972 "AT" "Austria"         .       .      .                .  10.14509841334987   .659136815349997 3280220048.61509  .02012405                .                . 14.2445723828885   6.20786098645996         .         .    53.825 . . . . 12.75671 0
    1973 "AT" "Austria"         .       .      .                .  5.440719809170005   .544656020082382 4335902626.19018 .025356155                .                . 14.6867458207583   4.89043542507672         .         .    54.075 . . . . 15.12157 0
    1974 "AT" "Austria"         .       .      .                .  10.71102081847266   .503121176626917   6428287967.073 .036113977                .                . 15.3485413051329   3.94213813939555         .         .     53.65 . . . . 14.29611 0
    1975 "AT" "Austria"         .       .      .                . -2.399192814902946   .197493687148713 6510895769.23949 .036784723                .                . 16.7899787187875  -.363735739528678         .         .      56.5 . . . . 14.21634 0
    1976 "AT" "Austria"         .       .      .                .  11.05940992218734   .212366202409436 6374077148.29675 .034454472                .                . 17.1817690787957   4.57844540313283         .         .     60.65 . . . . 14.43055 0
    1977 "AT" "Austria"         .       .      .                .  2.394315712264671   .187821782678742 6813640726.05985 .034941748                .                . 17.0109080701459   5.07998079916527         .         .    64.875 . . . . 13.55427 0
    1978 "AT" "Austria"         .       .      .                .  8.728567082701815   .229467385721991 9804525357.23644  .05053879                .                . 17.6562140182671  -.210653450960095         .         .     69.35 . . . .  12.6765 0
    1979 "AT" "Austria"         .       .      .                .  11.32421535780364   .253497717955077 14883522738.0883  .07260255                .                . 17.5220947153094   5.35669983130138         .         . 74.600006 . . . . 12.77729 0
    1980 "AT" "Austria"    -4.776   6.325 25.919                .  3.681569203014419   .291624498184505 17725433544.0942  .08521843                .                . 17.5341448172113   1.73148542809489         .         .      79.4 . . . . 13.27729 0
    1981 "AT" "Austria"    -4.338   6.807 24.598                .  4.883444915674588   .461073619768896 13676529640.2529  .06575254                .                . 17.9647044912803  -.144294518362841         .         .    83.425 . . . . 11.90772 0
    1982 "AT" "Austria"     1.003    5.44 23.647                . -.0849180902736464   .291710695365233 14949075030.3479  .07051451                .                . 18.3466777107019   2.01125436553259         .         .     84.15 . . . . 10.57355 0
    1983 "AT" "Austria"      .389   3.335 21.977                .  1.583949624653954    .29966502251742 12575296676.6522  .05742145                .                .  18.346321668112   2.97308802055163 -.4830687         .        82 . . . . 11.36683 0
    1984 "AT" "Austria"     -.266   5.665 23.015                .  8.320294148490774   .169502455427598 10759891540.7682  .04913193                .                .  18.388731219501  .0512752525777955  .5428249         .     81.85 . . . .  11.7364 0
    1985 "AT" "Austria"      -.23    3.19 22.998                .  8.954400668118609   .249479626524679 11678513739.8946  .05213622                .                . 18.5778439827762    2.4986784712659  .4871406         .      84.7 . . . .  21.5668 0
    1986 "AT" "Austria"       .21   1.737 23.096                . -4.052241092309686   .188356395792025 14426653335.3039  .06299849                .                . 18.7854384188693   2.30139280099837  3.426551         .    85.275 . . . . 28.10557 0
    1987 "AT" "Austria"     -.216   1.408 23.305                .  3.431828562480803   .329814979081076 17768883013.4546  .07659002                .                . 18.7520822072581   1.35716798439928  4.639008         .     87.75 . . . .  23.8864 0
    end
    where A2 is 2-letter Country Code, Cty is Country Name,CA is Current Account as % of GDP,Inf is annual Inflation rate,Sav is National Savings as % of GDP,Cred is Domestic Credit as % of GDP,EXg is Annual Export Growth rate,FDI is net inflow of Foreign Direct Investment as % of GDP,FX is Total Reserves,FX_gdp is Foreign Reserves as % of GDP,M2_R is M2-to-Reserves Ratio,Int is Global Lending Interest Rate,GExp is Government Expenditure as % of GDP, GDPg is Annual GDP Growth rate,REERov is Real Effective Exchange Rate Overvaluation,Debt is Gross Debt Stock as % of GDP,CGap is Credit-to-GDP gap,Rpp is Real Property Price indices,PpGr is Property Price Growth Rate,A_DSR is Aggregate Debt Service Ratio(DSR),H_DSR is Household DSR, Share is Equity Price indice & CDum is Currency Crisis Dummy Variable(1= Crisis happened in that year;0=no crisis occurred).

    I used the following codes to run a logistic regression (I'm using lagged values of the regressors[by 1 period] in my regression).

    Code:
    egen cntry = group(A2)  /*as A2 is a string variable,need to generate a numeric variable as a Country ID before xtset as panel data*/
    xtset cntry year
    
    logistic Currency_crises_Dum L.YrAvgCred_GDP_Gap L.YrAvgRealPropP L.YrAvgPropPGrow ///
    L.YrAvgAgg_DSR L.YrAvgHH_DSR L.CA L.Inflation L.NSavings L.DomesticCredit L.ExportsGrowth ///
    L.FDI L.ForexReserves L.ForexReserves_GDP L.M2_Reserves L.GlobalInterest L.GovExpenditures ///
    L.GDPGrowth L.REER_overvaluation L.TotalDebt L.EquityPriceIndex
    Stata returns this error message

    PHP Code:
    no observations
    r
    (2000); 
    I've checked that all of my variables(except Country Code A2 & Country Name Cty) are numeric variables,as shown by the output after describe command.
    PHP Code:
    des

    Contains data
      obs
    :           100                          
     vars
    :            24                          
     size
    :        19,400                          
    --------------------------------------------------------------------------------
                  
    storage   display    value
    variable name   type    format     label      variable label
    --------------------------------------------------------------------------------
    Yr              float   %9.0g                 
    A2              str2    
    %9s                   
    Cty             str52   
    %52s                  
    CA              double  
    %10.0g                
    Inf             double  
    %10.0g                
    Sav             double  
    %10.0g                
    Cred            double  
    %10.0g                
    EXg             double  
    %10.0g                
    FDI             double  
    %10.0g                
    FX              double  
    %10.0g                
    FX_gdp          float   
    %9.0g                 
    M2_R            double  
    %10.0g                
    Int             double  
    %10.0g                
    GExp            double  
    %10.0g                
    GDPg            double  
    %10.0g                
    REERov          float   
    %9.0g                 
    Debt            float   
    %9.0g                 
    CGap            float   
    %9.0g                 
    RPp             float   
    %9.0g                 
    PpGr            float   
    %9.0g                 
    A_DSR           double  
    %10.0g                
    H_DSR           double  
    %10.0g                
    Share           float   
    %9.0g                 
    CDum            float   
    %9.0g                 
    --------------------------------------------------------------------------------
    Sorted by
         
    NoteDataset has changed since last saved
    It'll be grateful if you don't mind giving me some advice on what has happened. My guess is maybe it's due to missing values in my dataset for some of the variables,but I'm not pretty sure if this is the real cause of this problem.

    Thank you very much.

  • #2
    A number of variables in your example data have all observations missing, so that could be a problem
    Further missings could be created through the use of lags

    It's difficult to be specific as the logistic regression you provide use variables (or variable names) that are entirely different from what is included in your data example

    Comment


    • #3
      Thanks for replying me, Jorrit. My mistake,I'm sorry. The variable names in the logistic command are the original variable names in my dataset.When I used these original variable names to generate data example using dataex command, I'm not sure why Stata displayed
      "input statement exceeds linesize limit. Try specifying fewer variables
      r(1000);"
      That's why I shorten the names of the variables by renaming them. I'm very sorry for my carelessness.

      This should be the equivalent counterpart of the code in my 1st message when running the logistic regression.

      Code:
      egen cntry = group(A2)  /*as A2 is a string variable,need to generate a numeric variable as a Country ID before xtset as panel data*/
      xtset cntry Yr
      
      logistic CDum L.CGap L.RPp L.PpGr L.A_DSR L.H_DSR L.CA L.Inf L.Sav L.Cred L.EXg L.FDI L.FX L.FX_gdp L.M2_R L.Int L.GExp L.GDPg L.REERov L.Debt L.Share
      I apologize again for my mistake,& it'll be great if you don't mind shedding some light on my issue. Thank you very much.

      Comment


      • #4
        Starting from your data example:
        Code:
        keep CDum CGap RPp PpGr A_DSR H_DSR CA Inf Sav Cred EXg FDI FX FX_gdp M2_R Int GExp GDPg REERov Debt Share
        to retain just the variables that you are trying to include in your regression, and where problems could arise.

        Then doing:
        Code:
        . sum
            Variable |        Obs        Mean    Std. Dev.       Min        Max
        -------------+---------------------------------------------------------
                  CA |         70   -.7220714    10.05976    -28.697      49.98
                 Inf |         52    213.8678    702.0035     -1.167    4146.01
                 Sav |         70    19.51304    9.331901       .098     48.881
                Cred |         57    15.95241    8.322314   2.013643    39.7175
                 EXg |         69    9.062739    21.50573  -19.50909   150.0078
        -------------+---------------------------------------------------------
                 FDI |         90    2.806689    6.094186  -4.618014   40.16725
                  FX |         75    1.11e+10    1.18e+10   2.03e+08   5.22e+10
              FX_gdp |         75    .0531829    .0487067   .0017001   .2393117
                M2_R |         57     4.38745    3.573382   .9913413   19.71644
                 Int |         33    44.69758    53.41597   6.163242    217.875
        -------------+---------------------------------------------------------
                GExp |         73     17.8522    10.51117   2.975538   57.14286
                GDPg |         89    3.478254    6.779985  -23.98342    23.1896
              REERov |          5    1.722491    2.190439  -.4830687   4.639008
                Debt |         63    6.332913    7.416589   1.621998   28.67718
                CGap |         45    47.83222    21.43105     18.625      87.75
        -------------+---------------------------------------------------------
                 RPp |          0
                PpGr |          0
               A_DSR |          0
               H_DSR |          0
               Share |         18    14.75202    4.790783   10.57355   28.10557
        -------------+---------------------------------------------------------
                CDum |        100         .42     .496045          0          1
        
        .
        We can see a number of variables with problems, as they have zero observations. If you include them in a regression, Stata will do listwise deletion, meaning the entire observation is excluded from your regression.

        Note also that if you'd include REERov, Stata would use -at most- 5 observations.
        However, if we look at only those observations, you would see that other variables are missing where REERov is not:
        Code:
        . sum if REERov!=.
        
            Variable |        Obs        Mean    Std. Dev.       Min        Max
        -------------+---------------------------------------------------------
                  Yr |          5        1985    1.581139       1983       1987
                  A2 |          0
                 Cty |          0
                  CA |          5      -.0226    .3013218      -.266       .389
                 Inf |          5       3.067    1.685062      1.408      5.665
        -------------+---------------------------------------------------------
                 Sav |          5     22.8782    .5183683     21.977     23.305
                Cred |          0
                 EXg |          5    3.647646    5.328906  -4.052241   8.954401
                 FDI |          5    .2473637    .0690694   .1695025    .329815
                  FX |          5    1.34e+10    2.77e+09   1.08e+10   1.78e+10
        -------------+---------------------------------------------------------
              FX_gdp |          5    .0596556    .0108424   .0491319     .07659
                M2_R |          0
                 Int |          0
                GExp |          5    18.57008    .2015685   18.34632   18.78544
                GDPg |          5    1.836321    1.157932   .0512753   2.973088
        -------------+---------------------------------------------------------
              REERov |          5    1.722491    2.190439  -.4830687   4.639008
                Debt |          0
                CGap |          5      84.315     2.46498      81.85      87.75
                 RPp |          0
                PpGr |          0
        -------------+---------------------------------------------------------
               A_DSR |          0
               H_DSR |          0
               Share |          5     19.3324      7.4808   11.36683   28.10557
                CDum |          5           0           0          0          0
               cntry |          5           3           0          3          3

        Comment


        • #5
          I sort of understand the message that you're trying convey-that in some of countries,for the variables that have non-missing values but with relatively few observations, there are also quite a lot of missing values for other variables & these cases (with zero observations) are excluded by Stata when doing the logistic regression. When I tried to look at my entire panel dataset with 70 countries in total spanning from years 1970-2010, it does seems that the variables H_DSR, A_DSR, RPp and PpGrare causing the problem because of having a lot of missing values in many countries in the dataset.

          Code:
          . su
          
              Variable |        Obs        Mean    Std. Dev.       Min        Max
          -------------+---------------------------------------------------------
                    CA |      2,068   -1.284014    6.260895    -58.781      49.98
                   Inf |      2,101    49.67484     494.353    -72.729    13109.5
                   Sav |      2,100    21.26301     8.59684     -7.392     57.494
                  Cred |      2,224    48.59894    43.18164   1.542268   312.0269
                   EXg |      2,443    6.149272    10.58553  -40.59951   150.0078
          -------------+---------------------------------------------------------
                   FDI |      2,494    2.271167    4.226128  -15.98922   87.44259
                    FX |      2,688    2.79e+10    1.14e+11   210643.2   2.91e+12
                FX_gdp |      2,621    .0643604     .090958   .0001901   1.058765
                  M2_R |      2,052    7.457342    10.07149   .5754847   147.5984
                   Int |      1,520    103.7206    3129.044         .5     121906
          -------------+---------------------------------------------------------
                  GExp |      2,596    15.20321    5.077867   2.047121   57.14286
                  GDPg |      2,686    3.689977    4.275947  -26.47879   33.73578
                REERov |      1,301   -6.121121     66.5066  -1234.183   201.8287
                  Debt |      1,579    8.508405    11.79384   .3921061   111.1151
                  CGap |      1,365    99.70363    50.90739      13.15     322.75
          -------------+---------------------------------------------------------
                   RPp |        567    82.21806    25.01278    22.3225     152.56
                  PpGr |        527    2.304606    7.563791    -20.645       34.6
                 A_DSR |        357     14.8757     6.20151      3.075     32.975
                 H_DSR |        204    10.06667    4.050567          3       22.9
                 Share |      1,120    55.09101    73.94754          0   1246.917
          -------------+---------------------------------------------------------
                  CDum |      2,870    .1986063    .3990204          0          1
                 cntry |      2,870        35.5    20.20872          1         70
          Code:
          su if REERov~=.
          
              Variable |        Obs        Mean    Std. Dev.       Min        Max
          -------------+---------------------------------------------------------
                    CA |      1,255   -.5234367    6.334117    -58.781     26.059
                   Inf |      1,288    30.33694    361.7642     -6.986   11749.63
                   Sav |      1,295    21.86698    8.717935     -5.674     57.494
                  Cred |      1,048     66.1855    51.48746   2.209409   312.0269
                   EXg |      1,193    6.172217     8.75581  -30.70184    87.4513
          -------------+---------------------------------------------------------
                   FDI |      1,278    3.150816    5.249696  -15.98922   87.44259
                    FX |      1,273    4.75e+10    1.60e+11   4.54e+07   2.91e+12
                FX_gdp |      1,260    .0853416    .1161792   .0035553   1.058765
                  M2_R |        907    8.502691    12.10447   .6471766   90.94436
                   Int |        906    17.38738    18.05468         .5     174.45
          -------------+---------------------------------------------------------
                  GExp |      1,276    16.20101    4.857238   3.215653   43.47921
                  GDPg |      1,287    3.294418    3.483965   -10.7517   33.73578
                REERov |      1,301   -6.121121     66.5066  -1234.183   201.8287
                  Debt |        567    5.156523    4.553353   .3921061   41.27779
                  CGap |        820     117.288    50.67152      21.45     322.75
          -------------+---------------------------------------------------------
                   RPp |        449    83.20248    23.59309     31.965     152.56
                  PpGr |        419    2.584791    7.410119    -20.645       34.6
                 A_DSR |        300     15.7995    5.798975        3.2     32.975
                 H_DSR |        192    10.04388    4.165959          3       22.9
                 Share |        773     72.4316    82.28395          0   1246.917
          -------------+---------------------------------------------------------
                  CDum |      1,301    .1829362    .3867629          0          1
                 cntry |      1,301    33.24135    20.52807          3         69
          Code:
          su if H_DSR~=.
          
              Variable |        Obs        Mean    Std. Dev.       Min        Max
          -------------+---------------------------------------------------------
                    CA |        204    .9326618    5.502501    -12.126     16.232
                   Inf |        204    2.048735    1.155815      -1.35      5.116
                   Sav |        204    24.16348    6.024155     10.408     41.765
                  Cred |        182    120.9132    40.55534   52.71873   221.2885
                   EXg |        204    4.146558    6.836559  -23.42677   24.91055
          -------------+---------------------------------------------------------
                   FDI |        201    5.008408    8.658841  -3.654668   87.44259
                    FX |        204    1.05e+11    1.88e+11   7.50e+09   1.10e+12
                FX_gdp |        204    .0602393    .0554678   .0101102   .2680216
                  M2_R |        100    20.60291    18.27816   2.720927   71.78369
                   Int |        126    5.433892     2.16024         .5   10.00917
          -------------+---------------------------------------------------------
                  GExp |        204    19.88359    3.281475   11.33834   27.93502
                  GDPg |        204    2.060202    2.473669  -8.269037   11.30862
                REERov |        192    .2940539    4.780521  -17.61548   10.85699
                  Debt |          0
                  CGap |        204    161.6088    34.67781     71.975     248.65
          -------------+---------------------------------------------------------
                   RPp |        157    92.69786    17.70085     50.715     152.56
                  PpGr |        149    3.580201    6.212369     -18.28    22.1125
                 A_DSR |        204    18.38137    4.250083      9.225     30.875
                 H_DSR |        204    10.06667    4.050567          3       22.9
                 Share |        204    99.05402    32.82757   32.50166   215.8493
          -------------+---------------------------------------------------------
                  CDum |        204    .0931373    .2913396          0          1
                 cntry |        204    30.88235    18.24912          4         65

          Comment


          • #6
            And the summary Statistics for situations when A_DSR,RPp and PpGr are respectively non-missing:

            Code:
            su if A_DSR~=.
            
                Variable |        Obs        Mean    Std. Dev.       Min        Max
            -------------+---------------------------------------------------------
                      CA |        357    1.290779    5.840945    -12.126     16.526
                     Inf |        357    3.908347    6.034657       -1.4     85.742
                     Sav |        357    25.11018    7.481475     10.408     52.344
                    Cred |        330    97.52027     51.3222   12.87772   221.2885
                     EXg |        345    5.314169      7.7891  -31.80498   27.17641
            -------------+---------------------------------------------------------
                     FDI |        354    4.354138    7.639072  -15.98922   87.44259
                      FX |        357    1.28e+11    2.86e+11   7.50e+09   2.91e+12
                  FX_gdp |        357    .0966868    .0939701   .0101102   .5044807
                    M2_R |        242     11.1925    14.25269   1.162258   71.78369
                     Int |        253    9.872077     11.4129         .5   80.44333
            -------------+---------------------------------------------------------
                    GExp |        357    17.65439    4.456823   6.531995   27.93502
                    GDPg |        357    3.150273    3.182454  -8.269037   14.23139
                  REERov |        300    .5405962    6.467276  -27.10333   15.35399
                    Debt |        117    6.049529    3.091908   1.905836    15.3776
                    CGap |        357    124.7482    59.76955      20.35     248.65
            -------------+---------------------------------------------------------
                     RPp |        245    91.54063    19.50594      36.42     152.56
                    PpGr |        226    3.646029    7.145551     -18.28       34.6
                   A_DSR |        357     14.8757     6.20151      3.075     32.975
                   H_DSR |        204    10.06667    4.050567          3       22.9
                   Share |        333    84.03889    38.18356   6.926031   215.8493
            -------------+---------------------------------------------------------
                    CDum |        357    .1120448    .3158643          0          1
                   cntry |        357    34.36134    19.39002          4         68
            Code:
             su if RPp~=.
            
                Variable |        Obs        Mean    Std. Dev.       Min        Max
            -------------+---------------------------------------------------------
                      CA |        521    .9759846    6.161931    -23.289     26.059
                     Inf |        521    4.428344    4.658451     -1.676     30.344
                     Sav |        521    24.24682    8.119599      3.224     53.127
                    Cred |        515    92.71012     47.3135   16.01332   312.0269
                     EXg |        560    4.879475     6.75096  -23.42677   34.72334
            -------------+---------------------------------------------------------
                     FDI |        554    3.790251    7.062213  -15.98922   87.44259
                      FX |        567    7.80e+10    2.18e+11   3.55e+08   2.91e+12
                  FX_gdp |        557    .0936046    .1339409   .0029241   .9799141
                    M2_R |        445    11.27824    12.18362   1.072673   71.78369
                     Int |        386    11.50765    10.15643         .5   67.08333
            -------------+---------------------------------------------------------
                    GExp |        557    17.52188     4.55086   7.257458   27.93502
                    GDPg |        556    2.932316    3.196286  -8.269037   15.24038
                  REERov |        449   -.1459368    7.560785  -37.98346   20.75311
                    Debt |        122    5.660245    2.621728   1.447233   13.25741
                    CGap |        525    124.4148    53.14698     22.925     322.75
            -------------+---------------------------------------------------------
                     RPp |        567    82.21806    25.01278    22.3225     152.56
                    PpGr |        527    2.304606    7.563791    -20.645       34.6
                   A_DSR |        245    16.08122    6.202108      3.075     30.875
                   H_DSR |        157    10.55318     4.17923          3       22.9
                   Share |        513    74.82216    92.74776   1.199804   1246.917
            -------------+---------------------------------------------------------
                    CDum |        567    .1146384    .3188664          0          1
                   cntry |        567    34.97531    20.81135          3         68

            Code:
             su if PpGr~=.
            
                Variable |        Obs        Mean    Std. Dev.       Min        Max
            -------------+---------------------------------------------------------
                      CA |        485    1.070858    6.112571    -23.289     26.059
                     Inf |        485    4.370573    4.578604     -1.676     30.344
                     Sav |        485    24.22581      8.0866      3.224     52.344
                    Cred |        481    94.13903    47.23708   17.75516   312.0269
                     EXg |        522    4.849419    6.732369  -23.42677   24.91055
            -------------+---------------------------------------------------------
                     FDI |        515    3.751856    6.952926  -15.98922   87.44259
                      FX |        527    7.75e+10    2.19e+11   3.55e+08   2.91e+12
                  FX_gdp |        518    .0926754    .1346256   .0029241   .9799141
                    M2_R |        418    11.62497     12.4183   1.072673   71.78369
                     Int |        363    11.36523    9.923224         .5   67.08333
            -------------+---------------------------------------------------------
                    GExp |        518    17.55982    4.529142   8.109508   27.93502
                    GDPg |        517    2.915162    3.180879  -8.269037   15.24038
                  REERov |        419   -.0865587    7.535212  -37.98346   20.75311
                    Debt |        108    5.723981    2.598955   1.447233   13.25741
                    CGap |        491    125.3504    53.38337     24.075     322.75
            -------------+---------------------------------------------------------
                     RPp |        527    81.92887     24.8642    22.3225     152.56
                    PpGr |        527    2.304606    7.563791    -20.645       34.6
                   A_DSR |        226    16.32622    6.152245      3.075     30.875
                   H_DSR |        149    10.59581    4.199893          3       22.9
                   Share |        481    74.95662    94.22797   1.199804   1246.917
            -------------+---------------------------------------------------------
                    CDum |        527    .1100569     .313258          0          1
                   cntry |        527    35.02277    20.96157          3         68

            Comment


            • #7
              Then maybe I need to give up on these variables with lots of missing values in my regression model by not including them in the estimation.

              Thank you very much for your help,Jorrit.

              Comment


              • #8
                Yes, the message in a nutshell was that if, in any of your 20 or so variables, one of the variables is missing, the entire observation is dropped form the model.
                Or the other way around, you need values for every variable for an observation to be included

                Comment

                Working...
                X