Announcement

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

  • repeated time values within panel r(451)

    Hey guys,
    I got the error:
    repeated time values within panel r(451), when I set the list of firms of my datasat as Panel variable. My dataset includes several firms and their characteristics such as Profit and leverage and all their loan contracts. There are firms that got granted several loans in the same year and thus Stata finds the same values for firms. How can I still tell Stata that I have Panel data even though I have repeated values? Again since firms have several loans, there characteristics like Profit occur more often for the same time. I hope you understand the Situation.
    Many thanks in Advance.

    Marcel

  • #2
    xtset requires only a panel identifier.

    That said, any assumptions about dependence structure are on you.

    What model(s) are you intent on fitting?

    Comment


    • #3
      Stata requires that for each Panel identifier
      there exists a unique time value but in my Analysis, I got several loans from one year for each firm. I would like to run a multiple Regression Analysis with a time fixed and bank fixed effects model and wanted to use the xtreg command after Setting the Panel variable.

      Comment


      • #4
        "Stata requires that for each panel identifier there exists a unique time value" is incorrect as already explained in #2.

        Rather, the model you want requires a time identifier too. That model, as I understand it, is out of order so far as Stata is concerned, Either you combine loans for each year somehow or you use a different model.

        Comment


        • #5
          So what I intent on doing is the following: I have the loan rate as dependent and firm and loan characteristics as Independent variables and I want to Control for time effects as well as Variation due to the bank that is granting the loan. What other model could I use? Comining loans is not possible since I examine the loan rate of each loan.

          Comment


          • #6
            Good question which is wide open.

            Comment


            • #7
              Marcel:
              perhaps you can add to years fictitious days and months to create a new -timevar- that does not suffer from the same drawback.
              Kind regards,
              Carlo
              (Stata 15.1 SE)

              Comment


              • #8
                Thanks Carlo for the advice. I will try to do that. Another problem that occured was that Stata requires the panel variable to be numeric so I used the encode command for my list of firms and created a new variable. Stata listed the firms that have unique firm characteristics like age and number of employees. However, all the observations from the same firm are omitted. Is there an option to tell Stata that there are several observations at each firm that only differ in the loan characteristics and which is still valid to use as panel variable?

                Comment


                • #9
                  Marcel:
                  I would not use -encode- for that purpose.
                  If your -panelid- is in -string- format (and provided that you have no leading/trail blanks), you may want to try:
                  Code:
                  egen new_panelid=group(panelid)
                  order new_panelid, first
                  Kind regards,
                  Carlo
                  (Stata 15.1 SE)

                  Comment


                  • #10

                    input float new_panelid double Loanrate byte Numberofemployees long(GrossProfit Loanamount) byte Lengthofrelationship float Housebankdummy
                    2 .089 15 800000 30000 6 1
                    2 .089 15 800000 20000 6 1
                    3 .109 10 850000 80000 10 1
                    3 .109 10 850000 80000 10 0
                    3 .109 10 850000 120000 10 0
                    4 .082 25 3500000 100000 5 0
                    4 .079 25 3500000 230000 5 0
                    5 .079 8 300000 15000 5 0
                    6 .098 12 800000 15000 10 0
                    6 .098 12 800000 15000 10 0
                    6 .098 12 800000 15000 10 0
                    6 .099 12 800000 120000 10 0
                    6 .099 12 800000 120000 10 0
                    6 .089 12 800000 10000 10 0
                    10 .098 3 600000 8000 10 0
                    10 .098 3 600000 8000 5 0
                    10 .089 3 600000 10000 0 0
                    11 .089 29 2000000 100000 1 0
                    11 .079 29 2000000 200000 0 0
                    11 .089 29 2000000 100000 2 0
                    12 .098 9 430000 15000 5 1
                    12 .089 9 430000 25000 5 1
                    12 .089 9 430000 15000 5 1
                    13 .109 15 1500000 150000 15 1
                    13 .109 15 1500000 150000 16 1
                    13 .109 15 1500000 150000 17 1
                    14 .034 3 400000 20000 8 1
                    15 .089 25 1100000 50000 15 1
                    16 .079 25 2000000 50000 20 1
                    18 .098 9 1000000 50000 6 1
                    18 .098 9 1000000 80000 6 1
                    18 .098 9 1000000 80000 6 1
                    18 .089 9 1000000 80000 6 1
                    19 .089 6 430000 30000 20 0
                    19 .089 6 430000 45000 20 0
                    20 .097 30 3000000 60000 5 0
                    20 .088 30 3000000 50000 1 0
                    21 .07 15 2600000 50000 18 0
                    22 .095 33 2350000 80000 23 1
                    23 .092 26 1750000 80000 20 1
                    end
                    [/CODE]
                    ------------------ copy up to and including the previous line ------------------

                    Listed 40 out of 82 observations

                    I tried to run the xtreg command without setting the time series variable, because the error still occurs and thus I do not give importance to the order of the time. I want to estimate a time fixed effects model and used:
                    Code:
                     xtreg Loanrate Numberofemployees Corporationdummy GrossProfit PretaxProfitMargin Leverage Loanamount Maturity g1 g2 Lengthofrelationship Housebankdummy if Purposeofloan!="Kredit", fe
                    and end up having only 4 observations and most of my variables got ommitted due to collinearity. Do you see a mistake?
                    Also, is it possible to implement a simultanaeous bank fixed effects model so that Variation due to different Banks is also controlled for?
                    Last edited by Marcel Issa; 11 Jan 2019, 08:24.

                    Comment


                    • #11
                      Marcel:
                      as far as the data excerpt you share with the list is concerned, the answer is pretty trivial: -re- outerforms -fe- specification (you have too many time-invariant predictors that are (correctly) wiped away by the -fe- estimator):
                      Code:
                      . xtset new_panelid
                             panel variable:  new_panelid (unbalanced)
                      
                      . xtreg Loanrate Numberofemployees GrossProfit Housebankdummy , fe
                      note: Numberofemployees omitted because of collinearity
                      note: GrossProfit omitted because of collinearity
                      
                      Fixed-effects (within) regression               Number of obs     =         40
                      Group variable: new_panelid                     Number of groups  =         18
                      
                      R-sq:                                           Obs per group:
                           within  =      .                                         min =          1
                           between = 0.0267                                         avg =        2.2
                           overall =      .                                         max =          6
                      
                                                                      F(1,21)           =       0.00
                      corr(u_i, Xb)  =      .                         Prob > F          =     1.0000
                      
                      -----------------------------------------------------------------------------------
                               Loanrate |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      ------------------+----------------------------------------------------------------
                      Numberofemployees |          0  (omitted)
                            GrossProfit |          0  (omitted)
                         Housebankdummy |          0   .0050374     0.00   1.000    -.0104758    .0104758
                                  _cons |      .0919   .0023583    38.97   0.000     .0869957    .0968043
                      ------------------+----------------------------------------------------------------
                                sigma_u |  .01650199
                                sigma_e |  .00411299
                                    rho |  .94151182   (fraction of variance due to u_i)
                      -----------------------------------------------------------------------------------
                      F test that all u_i=0: F(17, 21) = 22.87                     Prob > F = 0.0000
                      
                      
                      . estimates store fe
                      
                      . xtreg Loanrate Numberofemployees GrossProfit Housebankdummy , re
                      
                      Random-effects GLS regression                   Number of obs     =         40
                      Group variable: new_panelid                     Number of groups  =         18
                      
                      R-sq:                                           Obs per group:
                           within  = 0.0000                                         min =          1
                           between = 0.0737                                         avg =        2.2
                           overall = 0.0042                                         max =          6
                      
                                                                      Wald chi2(3)      =       1.03
                      corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.7939
                      
                      -----------------------------------------------------------------------------------
                               Loanrate |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                      ------------------+----------------------------------------------------------------
                      Numberofemployees |   .0007077   .0006994     1.01   0.312    -.0006631    .0020786
                            GrossProfit |  -5.44e-09   7.07e-09    -0.77   0.442    -1.93e-08    8.42e-09
                         Housebankdummy |  -.0011345   .0043854    -0.26   0.796    -.0097298    .0074607
                                  _cons |   .0840738   .0083929    10.02   0.000     .0676241    .1005235
                      ------------------+----------------------------------------------------------------
                                sigma_u |  .01708062
                                sigma_e |  .00411299
                                    rho |  .94519395   (fraction of variance due to u_i)
                      -----------------------------------------------------------------------------------
                      
                      . estimates store re
                      
                      . hausman fe re
                      
                                       ---- Coefficients ----
                                   |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
                                   |       fe           re         Difference          S.E.
                      -------------+----------------------------------------------------------------
                      Housebankd~y |           0    -.0011345        .0011345        .0024785
                      ------------------------------------------------------------------------------
                                                 b = consistent under Ho and Ha; obtained from xtreg
                                  B = inconsistent under Ha, efficient under Ho; obtained from xtreg
                      
                          Test:  Ho:  difference in coefficients not systematic
                      
                                        chi2(1) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                                                =        0.21
                                      Prob>chi2 =      0.6471
                      
                      .
                      Kind regards,
                      Carlo
                      (Stata 15.1 SE)

                      Comment


                      • #12
                        Thx Carlo. Could you please also tell me how I could include fixed effects of the Banks that are involved?

                        Comment


                        • #13
                          Marcel:
                          assuming that -banks- is your predictor, go -i.banks-.
                          Kind regards,
                          Carlo
                          (Stata 15.1 SE)

                          Comment

                          Working...
                          X