Announcement

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

  • Panel Data "repeated time values within panel r(451)" error. Involves companies and respective yearly data from 2016-2020.

    Hey everyone

    I have a balanced panel data which I am trying to perform a one-step GMM on, however whenever I try to perform the xtset command it simply gives me the error "repeated time values within panel r(451)" and I do not have an idea on how to fix it.

    I do have repeated values, specifically for my LaggedPC variable, however I do require the values. What can I do to resolve this issue?

    Here is my data ex:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str4 COMPANY int YEAR double(NCSKEW LaggedNCSKEW LaggedPC LaggedSize LaggedMB LaggedLev LaggedROA LaggedSTURN LaggedRet LaggedSIGMA) byte COVID
    "GDST" 2016  -2.0030901667720147   1.1517166657295128 0  26.90493743512234    .6 .32966666666666666 -.0466    .04044176829268293   -.008059106469312957 .052858209589498405 0
    "MAIN" 2016  -.19181810525230095    .5172590381052644 0 28.854796547550663   2.2               .625 -.0159    .11958027272727273  -.0011625834399904686  .06257024411684511 0
    "LMSH" 2016   .08552027279221759    .8702120321007045 0 24.734228790229462   .49 .15994020926756353  .0145              .0042875    -.00492869221263619  .09249917811621308 0
    "ISSP" 2016    .3663473399497577  -.04960811838215493 0 27.967493352549763   .53  .5185185185185185  .0292    .48871044444444445    .003315083040037781  .06333486038851283 0
    "MLIA" 2016    .2045855778788992   1.1649331621406214 0 27.247268574726032   .61  .8450704225352113 -.0219   .021729230769230768 -.00013673700216129255  .06602103044597234 0
    "SMSM" 2016   2.9491205431229757  .018188660860477955 0  29.56254252753176  4.76 .36363636363636365  .1926    .17297857142857143  .00021095426331089442 .029352416090589476 0
    "VOKS" 2016  -1.6634881692027956   .33727939677894025 0 27.425840264988512   1.6              .6602  .0002    .01107748766694742   .0039041951346703973  .05787241608814976 0
    "ALMI" 2016   1.3049051636618603     .588477512794341 0 25.527286881679668   .22  .7431363636363636 -.0245   .023790422077922077 -.00042401694403340265  .04249529904196876 0
    "PBRX" 2016   1.5472583426477675   -.3676944606108456 0 28.911954961390613  1.22  .5081967213114754  .0212     .6985273384615385    .006378977868561088  .05529366917409833 0
    "MERK" 2016   -2.288673513620532   -.5813007877760064 0 28.729633404596658  6.41   .262001246882793  .2319   .014365401785714285   .0017289829894677102 .036503908262833756 0
    "TIRT" 2016  -1.8341219390070844   .20899016742439525 0  24.64721741323983   .55  .8805031446540881 -.0011              .0342164   -.007095086794377628 .048369684232270165 0
    "IMPC" 2016  -1.8780676264159275   -2.130349919365671 0 29.135098512704822  4.08 .35294117647058826  .0458    1.0080533719486968    .006767963413444298 .027929472585227814 0
    "IMAS" 2016   .30809815976449584    .8540948142894345 0  29.50282329283014   .98  .7309236947791165 -.0018   .004238964285714286  -.0049718446138247215  .06856379094509238 0
    "BAJA" 2016  -1.5524344017574154    .6833137958234261 0 25.741869300691842   .94  .8296616422472858 -.0099    .08608255555555555   -.016545477711162167  .05245495851421341 0
    "ALKA" 2016   .46672259524786847    .8920621380178971 0 25.035406344156126   1.2  .5712309820193637 -.0082   .000748768472906404    -.01610801501984004   .1643128326788405 0
    "PTSN" 2016   1.3891996168823335  -.07899698853776463 0 25.638857582355772    .2   .227459484136042  .0017              .0111825   -.007833691741224898  .06636330079452618 0
    "ADES" 2016   -.5882385790706189   2.2512658205735225 0 27.118026474877716  1.82  .4972443355786895  .0503   .039148499745719614   -.003993034891925551  .04389306327711198 0
    "DPNS" 2016   .25179735903734596  -.05549121045027772 0   25.5760770458491   .53  .1209471766848816  .0399   .006904258532165509    .003826492297128131  .06173922634852741 0
    "BRPT" 2016  -1.2797819760059852   1.4535893015366155 0 27.533849204176274   .06  .4694533762057878 -.0024    .16692185714285715   -.022924367270429104 .053365762401236985 0
    "MYOR" 2016  -.39651771151449544    .9245296944122536 0 30.937907818119463  5.25  .5398230088495575  .1076     .3097618248909762 -.00016499018146958144  .04039685426575365 0
    "BRAM" 2016    .6289104831114689  -.10216952573020469 0 28.372958460657927   .83               .375  .0357               .000142   -.003295585942089087   .1168364804148515 0
    "AKPI" 2016  -.45227755637912986   -.7106917334788609 0  27.11182724249204   .54  .6206896551724138  .0096 .00019338235294117647   .0038805139683712043  .04259361000093731 0
    "SIDO" 2016  -1.7253104122230902   .20433496608667925 0   29.7472766307311  3.18 .07142857142857143  .1565    .20604455226666665   -.004669291013413578  .03179015671334256 0
    "INCI" 2016   1.2542256782109087   .06619940115206481 0 24.734228790229462   .36 .09085545722713864     .1    .09638015469613259   .0019538557435047166  .05200729449596414 0
    "SKBM" 2016   3.5878138739573058  -1.0812980625300554 0  27.50885348195434  2.57  .5499018966644866  .0545  .0008995194874532835   .0023391979606328774  .03968403728821579 0
    "CINT" 2016    .0933366035948885  -.29017528547995886 0  26.54631173242943  1.07 .17685475444096133   .074              .9706797 -.00040055825619203836   .0207758888484397 0
    "VOKS" 2017    .4750227863822869  -1.6634881692027956 0 27.813342672722502  1.82  .6064705882352941  .0959    .00683371435446998  -.0003624429577379108  .04331387736542048 0
    "BAJA" 2017    .9372214350918061  -1.5524344017574154 0 27.110145156309056  3.02  .8000203541624262   .035     .9079738333333334    .019868435101652964  .09626747035863086 0
    "SIDO" 2017   -.9027658025631566  -1.7253104122230902 0 29.685144849624095  2.83 .06666666666666667  .1608            .154257203  -.0052890316467148904 .036973858654516814 0
    "PTSN" 2017   -.7955219544688796   1.3891996168823335 0 25.389531122294315   .16 .23810597519729426  .0182   .014937008333333333   -.014635024707342043   .0691690114536147 0
    "SKBM" 2017  -.23116385936680575   3.5878138739573058 0 27.119194991828973  1.63              .6316  .0285    .00118430539241858   -.010344006594386074  .11774119240325255 0
    "LMSH" 2017   -.4171320689308561   .08552027279221759 0 24.759274822155547   .48  .2794840294840295  .0384          .06617815625  -.0037379306639985363  .09113501637565606 0
    "MERK" 2017    .5727390426949175   -2.288673513620532 0  29.04200808963881  7.07 .21669579244522114  .2068   .004660714285714285    .006911057186030017 .029867365725393887 0
    "DPNS" 2017   1.2750579725655142   .25179735903734596 0 25.609848482372687    .5 .11077338736913205  .0381   .011820900030202355  -.0035103798626474106  .07548464186446213 0
    "TIRT" 2017   .44531583952174636  -1.8341219390070844 0 25.563508145113985     1  .8446078431372549  .0355            .076261805      .0133069487325214   .0795571614644399 0
    "GDST" 2017  -1.1520803719767196  -2.0030901667720147 0  27.55478780992896  1.11  .3599230769230769  .0252     .0981645243902439    .005860087874091686  .08458444537506381 0
    "PBRX" 2017  -.05848520703556175   1.5472583426477675 0 28.729633404596658   .97  .5571428571428572  .0281    2.0432436923076924   -.005499214907140077  .05444064951003038 0
    "MYOR" 2017    .6063564026257222  -.39651771151449544 0  31.23651896110343  5.87  .5116279069767442  .1049   .010945553571428571    .004080355854579985  .03128378932617459 0
    "SMSM" 2017  -.14387571546729658   2.9491205431229757 0  29.35378771366965  3.57 .30434782608695654  .2009    .02125684482758621    -.00885707655713295 .033148967490792755 0
    "ALMI" 2017   -.3848741434315737   1.3049051636618603 0  25.44799525799214   .28              .8165 -.0464     .0326150974025974  -.0066203455018537935 .040215573333590986 0
    "BRPT" 2017    .2765954725423321  -1.2797819760059852 0 29.953408836218774   .53 .43478260869565216  .0512    3.7959205714285713    .023303372828361032   .1097657715866555 0
    "MAIN" 2017   1.2332579386392826  -.19181810525230095 0 28.695731852920975  1.58  .5384615384615384  .0739    .09914250545454545  -.0041165681786877895  .04466539222646246 0
    "BRAM" 2017    1.574977487481092    .6289104831114689 0 28.729633404596658  1.13               .325  .0651  .0005120066666666667   -.007977979384670188   .1446477186286434 0
    "AKPI" 2017   1.3911526423188623  -.45227755637912986 0  27.13999811945874   .55  .5769230769230769    .02 .00030676470588235295 -.00011783462761384586 .047980963758166045 0
    "INCI" 2017  -1.5251063202749748   1.2542256782109087 0  24.73784543069965   .23 .09873793615441723  .0371    .05842259668508287   -.006629339456409107 .027493198033585645 0
    "IMAS" 2017  -.11490864017933919   .30809815976449584 0 28.911954961390613   .54          .73828125 -.0113             .00644686   -.012240023481406645  .05255644684364741 0
    "CINT" 2017  -2.6508000048534512    .0933366035948885 0 26.479008050533324   .97  .1825694966190834  .0563             1.0154764 -3.887141611640444e-06 .007506724316451711 0
    "MLIA" 2017    .3087370762346879    .2045855778788992 0  27.31315471229945   .45  .7922077922077923  .0012  .0016648553846153847  -.0033405026793250745  .07391881116493625 0
    "ADES" 2017    .4013674054147138   -.5882385790706189 0  27.10321886795544  1.53  .4991530944625407  .0729    .01163604000678081  -.0033691376954889476   .0413923414413712 0
    "ALKA" 2017   .03434176680561635   .46672259524786847 0 25.679796872049465  2.33  .5527086383601757  .0038 .00037817608824108727   .0012959511107296694  .07237889224465394 0
    "ISSP" 2017    1.659462093049825    .3663473399497577 0  28.03648622403671   .57  .5666666666666667   .017     .4770349583333333   -.001620672119995807 .042768723325004976 0
    "IMPC" 2017   1.4555392467897106  -1.8780676264159275 0 29.240459028362647  4.04  .4782608695652174  .0451    .08240910416666666   -.001460061272392118 .018346643926892517 0
    "PTSN" 2018  -2.3034919335947213   -.7955219544688796 0  26.52629014625226   .48 .24810543657331136  .0073               .215638    .003473043169977092  .11023503333553179 0
    "DPNS" 2018   -.2527659723721649   1.2750579725655142 0 25.475993587292116   .43  .1319286871961102  .0229  .0038592570220477196   -.008861000358548992   .1062362281783611 0
    "MLIA" 2018  -.06958739053080938    .3087370762346879 0 27.383328691692927   .44  .6538461538461539  .0092  .0013972307692307693  -.0017033103484180082  .07212293245455761 0
    "ISSP" 2018   -1.479302195503182    1.659462093049825 0  27.44034475475184   .29  .5555555555555556  .0014               .150446    -.01600625867289207 .037866382323785065 0
    "CINT" 2018   3.5323215339499145  -2.6508000048534512 0  26.53440682992311   .87 .19785984053713807   .058              .9829792    .002294335109545965 .024429076892996126 0
    "IMPC" 2018    1.782113687396065   1.4555392467897106 0 29.298727936486625  4.09 .43478260869565216   .038   .021775291666666665   -.002210916745818179 .017203613099475254 0
    "BAJA" 2018   .18845052084945263    .9372214350918061 0 26.386226317082357  1.67  .8182586644125106 -.0243     .2014976111111111    -.01612001982979376    .059996086036414 0
    "ADES" 2018   .17232725946149327    .4013674054147138 0 26.981124977362917  1.23  .4965484408474173  .0455   .010864722834378709   -.006841346519450819  .02774930582211196 0
    "SMSM" 2018    .5675851960420207  -.14387571546729658 0 29.605102141950557  3.95                .25  .2044    .06152808620689655    .004932791893939369   .0368555064402912 0
    "MAIN" 2018    -.898861974787571   1.2332579386392826 0  28.16164936699072   .97  .5853658536585366   .012              .0647375   -.012957171044155929  .03428124795178955 0
    "SIDO" 2018   -.5275269623652035   -.9027658025631566 0 29.735155270198756  2.82             .09375   .169    .11273026813333334   -.003647435481103264 .029703645140465224 0
    "SKBM" 2018  -.07703122925517043  -.23116385936680575 0 27.813342672722502  1.21               .375  .0164   .005072823529411765   .0003192434059041287  .10135866303102381 0
    "KBLI" 2018   -1.711813751829484   .10104868784533985 0  28.16164936699072   .96                 .4  .1029           1.792929775  .00029764560537404226   .0774411719278873 0
    "ALKA" 2018   -.1375909763183723   .03434176680561635 0 25.768624567101053  1.98  .7427916120576671  .0505    .04737226708686232   -.014499706785415222   .1900467967729895 0
    "GDST" 2018   -.6989049007397994  -1.1520803719767196 0 27.234119238480872    .8  .3497692307692308   .008   .054113719512195124   -.011479930006662791  .05480003624873228 0
    "LMSH" 2018   1.1776066013159276   -.4171320689308561 0 24.840675672099508   .47 .19602977667493796  .0805    .17323541666666667    .001568936826283257  .07311362224216284 0
    "TIRT" 2018   .20185074210694337   .44531583952174636 0 25.223075507276675   .73  .8559292447340859  .0012              .3368385   -.010268652637531813  .10581706835767712 0
    "AKPI" 2018    .5408217902611509   1.3911526423188623 0   26.9237750109891   .44  .5925925925925926  .0049  .0002326470588235294    -.00685554071173486  .07592573603656645 0
    "MYOR" 2018   -.4061311959725293    .6063564026257222 0 31.442118202766732  6.14  .5033557046979866  .1069   .017445339285714286   -.002049231962982457  .04637746842337836 0
    "SMBR" 2018   .40909894885306763    .5216361593617928 0 31.260681210382515 11.05  .3333333333333333   .029    .21733987878787878  -.0035616969221883284  .06772186496945776 0
    "INTP" 2018 -.010752686697349445 .0036306668134000715 0   32.0229980814556  3.29 .14878892733564014  .0644                .10821    .004307645309448289  .04014768622259298 0
    "IMAS" 2018    .6329023829296261  -.11490864017933919 0 28.463930238863654   .25  .7038216560509554 -.0035             .00517575    -.01205133941545399  .03655256382277383 0
    "INCI" 2018   -.8217064877983599  -1.5251063202749748 0 25.025978664900567   .28 .11652402896642527  .0546    .09308745303867404  -.0006117189979553526  .03014851419700962 0
    "ALMI" 2018    .3102758415385029   -.3848741434315737 0 25.632237477266166   .36            .842125  .0036    .06264172077922078  -.0015478932801677382  .05090784644001131 0
    "BRAM" 2018   -.8017476670951371    1.574977487481092 0 28.824943584400984  1.13  .2926829268292683  .0733  .0003173333333333333   -.012291595454819764   .1747956067507738 0
    "PBRX" 2018   -.7236213103171915  -.05848520703556175 0 28.883784084423915  1.09  .5897435897435898  .0163     .9418027538461539   .0012204779924786498  .05128969343521848 0
    "BRPT" 2018    .5407003499264976    .2765954725423321 0 31.081008661760137  1.15  .4473684210526316  .0327            3.72530625  -.0004058024314758553  .06375584899325137 0
    "MERK" 2018    3.920309101202633    .5727390426949175 0  28.96602218266089  6.19 .27343565525383706  .1708   .002716517857142857   -.001856438087596683  .01507255996188058 0
    "SMSM" 2019   .12969393705993146    .5675851960420207 0  29.72288517760694  3.75 .21428571428571427  .1988    .10569479310344827   .0012826744594495304  .04390232763319675 0
    "BRPT" 2019   -.6388808129225102    .5407003499264976 0  31.38052519185892  1.09  .6166666666666667  .0103    1.1084769943820225   -.009549009064353145 .052669293499010617 0
    "KBLI" 2019   -.4925658966206211   -1.711813751829484 0 27.631021115928547    .6               .375  .0325            .384263875    -.01135881244089008 .055367485109481744 0
    "MLIA" 2019   1.7848287911670402  -.06958739053080938 0 28.101024745174282   .71  .5849056603773585  .0359   .027999384615384617    .010426327240899988  .05877941969471378 0
    "SMBR" 2019   .16560654499609612   .40909894885306763 0 30.487491322149033     5 .36363636363636365  .0137    .01837679797979798   -.018344073736997892  .07722692726774177 0
    "TIRT" 2019    .6116900635003157   .20185074210694337 0 24.861627284585285   .72  .9052414988087503 -.0395              .0585241  -.0063224209649861245 .044359747401414504 0
    "MERK" 2019    .3423015898306389    3.920309101202633 0 28.272875002100943  3.72  .6013076923076923   .921           .1037453125   -.014445711523925577  .09374087178425347 0
    "AKPI" 2019   1.2633878787752333    .5408217902611509 0 26.957676562664783   .41  .6129032258064516  .0209   .000920735294117647   -.003393898382755619  .10066166960327792 0
    "GDST" 2019    .7624347618991698   -.6989049007397994 0 27.490378786126083   .97                .36 -.0649    .13035358536585365  -.0057935279221506455  .12522929128260168 0
    "MYOR" 2019    .9762803110488695   -.4061311959725293 0 31.701755812511514  6.86  .5170454545454546  .0976   .014994754464285715  .00032363825508955116  .03785443471062478 0
    "PTSN" 2019   1.2844455580003347  -2.3034919335947213 0 28.883784084423915   3.5  .7619047619047619  .0417              .2690715     .03265421489827928  .10308768934627215 0
    "INCI" 2019    .9234542012719414   -.8217064877983599 0  25.44888217601037   .35 .18242207460398568  .0426    .12924894441611423   .0014025744631045215 .061329695819323314 0
    "INTP" 2019   -.5248943199209897 -.010752686697349445 0   31.8490571504932  2.92 .16546762589928057  .0412    .11705751351351351  -.0034180000173096854 .047794580309072306 0
    "MAIN" 2019   3.6578636411954704    -.898861974787571 0  28.76242322741965  1.65  .5581395348837209  .0657     .8987769545454546    .014150158769039543  .06975351957677924 0
    "ISSP" 2019  -1.2795895591362751   -1.479302195503182 0 27.126177563840105   .21  .5538461538461539  .0075    .41398697222222225   -.007703441365861038  .06878171570494879 0
    "ALMI" 2019    .9749125409592808    .3102758415385029 0 26.230222068605777   .75  .8831428571428571  .0024     .1111573051948052    .009230597700360662  .08765429237953018 0
    "IMPC" 2019    .7226706964269756    1.782113687396065 0 29.135098512704822  3.31  .4166666666666667  .0365   .014389291666666667  -.0059576418964460845 .017816578930009604 0
    "BAJA" 2019  -3.0410153095278405   .18845052084945263 0  26.03844032056087  2.66  .9151131824234354 -.1073    .14509372222222222   -.004768937018102834  .03569614764318668 0
    "ALKA" 2019   .05797103035502754   -.1375909763183723 0  25.74911809684753  1.51  .8448382126348228  .0354    .02517628520779988   -.006256122539500374  .09013501819496494 0
    "PBRX" 2019    .4694701840814101   -.7236213103171915 0 28.911954961390613   .98  .5714285714285714  .0316    .40183090769230767   .0035094939210414617 .032805492454132716 0
    end
    All help is very much appreciated. Thank you very much!

  • #2
    Matthew:
    if you do not have the chance to convert your -timevar- in something more detailed (eg, quarters of the same year, so to fix the -repeated time values- issue), there's no way you can make it, as you need -timevar- to invoke time-series related operators.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Check for duplicates:

      Code:
      bys COMPANY YEAR: gen tag= _N>1
      list if tag, sepby(COMPANY YEAR)

      Comment


      • #4
        See also https://www.stata.com/support/faqs/d...d-time-values/

        Comment


        • #5
          Originally posted by Carlo Lazzaro View Post
          Matthew:
          if you do not have the chance to convert your -timevar- in something more detailed (eg, quarters of the same year, so to fix the -repeated time values- issue), there's no way you can make it, as you need -timevar- to invoke time-series related operators.
          Hey Carlo, thanks for the response. I do believe I would like to keep a yearly analysis, meaning that I would prefer not to change the data to quarterly. Does this mean the only way around it would be to delete the duplicate data?

          Comment


          • #6
            Matthew:
            deleting duplicate data makes sense as long as they are really duplicate (ie, the _n+1 observation is identical in all variables to the _n observation).
            Otherwise, even though feasible, deleting observations within each panel just because they share the very same year (and you need to move forward with time-series operators) is questionable, as you end up with a subsample of your original dataset.
            Kind regards,
            Carlo
            (StataNow 18.5)

            Comment


            • #7
              Originally posted by Carlo Lazzaro View Post
              Matthew:
              deleting duplicate data makes sense as long as they are really duplicate (ie, the _n+1 observation is identical in all variables to the _n observation).
              Otherwise, even though feasible, deleting observations within each panel just because they share the very same year (and you need to move forward with time-series operators) is questionable, as you end up with a subsample of your original dataset.
              I understand. It seems to me that I do need these values and it would make sense for me not to delete them. However, if that is the case, what can I do to resolve this issue? Does this mean I cannot regress my data through the GMM?

              Comment


              • #8
                Matthew:
                the issue is that you cannot use time-series operators.
                Kind regards,
                Carlo
                (StataNow 18.5)

                Comment


                • #9
                  Cross-posted at https://www.reddit.com/r/stata/comme...in_panel_r451/

                  Please note our policy on cross-posting, which is that you should tell us about it.

                  Comment


                  • #10
                    Originally posted by Nick Cox View Post
                    Cross-posted at https://www.reddit.com/r/stata/comme...in_panel_r451/

                    Please note our policy on cross-posting, which is that you should tell us about it.
                    I apologize, I was just trying to get all the help I could get. Thanks for letting me know.

                    Comment

                    Working...
                    X