Announcement

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

  • #16
    Hi Clyde,

    i have removed the "/" in the date variables so they are now ddmmyyyy, which is a string variable which has the type:str8 format: %9s, is there a command which can turn this format into a date format readable for STATA. i tried format name_of_date_variable %td and it returns "string %fmt required for string variables
    r(120);"

    thanks


    Comment


    • #17
      -help date()-

      More generally, people who use Stata regularly need to familiarize themselves with Stata's approach to handling dates and times and the many function used to create and transform these variables. So, more broadly, read the Date and time functions chapter in the [FN] volume of the PDF manuals that come with your Stata installation. It's a long read, and you won't remember it all. But it will give you a comprehensive tour of this terrain and you will know what functions to look for in future situations. Then the help files will fill in the forgotten details.

      Comment


      • #18
        Hi Clyde, i have run the regression for the same property repeat sales model (LogPrice(After)-LogPrice(Before) = a + b*days_between_sales) could you help me interpret the results, including the Sum of squares and mean squares results?

        thank you

        Code:
        . by HOUSE_ID (sold_after_farm_operational_dumm), sort: keep if sold_after_farm_operational_dumm[_N] =
        > = 1 & sold_after_farm_operational_dumm[1] == 0 & _N == 2
        (2643 observations deleted)
        
        . by HOUSE_ID (sold_after_farm_operational_dumm): gen delta_log_price = log(Deflated_house_price[_N]/D
        > eflated_house_price[1])
        
        . by HOUSE_ID (sold_after_farm_operational_dumm): gen days_between_sales = Date[_N] - Date[1]
        
        . reg delta_log_price i. days_between_sales
        
              Source |       SS       df       MS              Number of obs =     182
        -------------+------------------------------           F( 89,    92) =   35.21
               Model |  17.5061425    89   .19669823           Prob > F      =  0.0000
            Residual |  .513900881    92  .005585879           R-squared     =  0.9715
        -------------+------------------------------           Adj R-squared =  0.9439
               Total |  18.0200433   181   .09955825           Root MSE      =  .07474
        
        ------------------------------------------------------------------------------------
           delta_log_price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------------+----------------------------------------------------------------
        days_between_sales |
                      697  |  -.3941674   .0747387    -5.27   0.000     -.542605   -.2457299
                      700  |   -.359604   .0747387    -4.81   0.000    -.5080416   -.2111664
                      746  |  -.1334763   .0747387    -1.79   0.077    -.2819139    .0149613
                      769  |   -.142736   .0647256    -2.21   0.030    -.2712867   -.0141853
                      820  |  -.1741309   .0747387    -2.33   0.022    -.3225684   -.0256933
                      882  |  -.3458721   .0747387    -4.63   0.000    -.4943097   -.1974345
                     1302  |  -.2153475   .0747387    -2.88   0.005    -.3637851   -.0669099
                     1381  |  -.4622693   .0747387    -6.19   0.000    -.6107069   -.3138317
                     1464  |  -.2882997   .0747387    -3.86   0.000    -.4367373   -.1398622
                     1737  |  -.3824733   .0747387    -5.12   0.000    -.5309108   -.2340357
                     1816  |   .2762742   .0747387     3.70   0.000     .1278366    .4247118
                     1940  |   -.501379   .0747387    -6.71   0.000    -.6498166   -.3529414
                     1942  |  -.1619683   .0747387    -2.17   0.033    -.3104059   -.0135307
                     2005  |   -.048905   .0747387    -0.65   0.515    -.1973426    .0995326
                     2463  |   .0721482   .0747387     0.97   0.337    -.0762894    .2205858
                     2541  |  -.3064635   .0747387    -4.10   0.000    -.4549011   -.1580259
                     2646  |  -.3789136   .0747387    -5.07   0.000    -.5273512    -.230476
                     2653  |   .6935585   .0747387     9.28   0.000      .545121    .8419961
                     2695  |   .1127382   .0747387     1.51   0.135    -.0356994    .2611757
                     2696  |  -.3584019   .0747387    -4.80   0.000    -.5068395   -.2099643
                     2716  |   .0458851   .0747387     0.61   0.541    -.1025524    .1943227
                     2751  |  -.3500189   .0747387    -4.68   0.000    -.4984565   -.2015813
                     2759  |  -.3834961   .0747387    -5.13   0.000    -.5319337   -.2350586
                     2765  |  -.6331525   .0747387    -8.47   0.000    -.7815901    -.484715
                     2766  |  -.3862727   .0747387    -5.17   0.000    -.5347103   -.2378351
                     2812  |  -.3920212   .0747387    -5.25   0.000    -.5404588   -.2435837
                     2863  |  -.5079789   .0747387    -6.80   0.000    -.6564165   -.3595413
                     3064  |  -.0702462   .0747387    -0.94   0.350    -.2186838    .0781914
                     3408  |  -.3161484   .0747387    -4.23   0.000    -.4645859   -.1677108
                     3447  |  -.0309224   .0747387    -0.41   0.680      -.17936    .1175152
                     3461  |  -.2400258   .0747387    -3.21   0.002    -.3884633   -.0915882
                     3510  |   .9880758   .0747387    13.22   0.000     .8396382    1.136513
                     3591  |  -.6031023   .0747387    -8.07   0.000    -.7515399   -.4546647
                     3598  |  -.2959608   .0747387    -3.96   0.000    -.4443984   -.1475233
                     3675  |  -.3309831   .0747387    -4.43   0.000    -.4794207   -.1825455
                     3797  |  -.2950603   .0747387    -3.95   0.000    -.4434979   -.1466227
                     3857  |  -.2572535   .0747387    -3.44   0.001    -.4056911   -.1088159
                     3997  |  -.6548469   .0747387    -8.76   0.000    -.8032845   -.5064093
                     4027  |  -.3631889   .0747387    -4.86   0.000    -.5116265   -.2147513
                     4130  |   -.323994   .0747387    -4.34   0.000    -.4724316   -.1755564
                     4169  |   .2220552   .0747387     2.97   0.004     .0736176    .3704928
                     4346  |  -.3002426   .0747387    -4.02   0.000    -.4486802    -.151805
                     4463  |  -.3508526   .0747387    -4.69   0.000    -.4992902    -.202415
                     4526  |  -.5285985   .0747387    -7.07   0.000    -.6770361   -.3801609
                     4702  |  -.2785239   .0747387    -3.73   0.000    -.4269615   -.1300863
                     4729  |   .2274483   .0747387     3.04   0.003     .0790107    .3758859
                     4793  |  -.8981839   .0747387   -12.02   0.000    -1.046621   -.7497463
                     4809  |   .0233454   .0747387     0.31   0.755    -.1250921     .171783
                     4876  |   .9356782   .0747387    12.52   0.000     .7872406    1.084116
                     4885  |  -.2644164   .0747387    -3.54   0.001     -.412854   -.1159788
                     4962  |  -.5614433   .0747387    -7.51   0.000    -.7098809   -.4130057
                     5106  |  -.4286973   .0747387    -5.74   0.000    -.5771349   -.2802597
                     5124  |   -.324702   .0747387    -4.34   0.000    -.4731396   -.1762645
                     5152  |  -.2739211   .0747387    -3.67   0.000    -.4223587   -.1254835
                     5253  |  -.3397644   .0747387    -4.55   0.000     -.488202   -.1913268
                     5271  |  -.2804312   .0747387    -3.75   0.000    -.4288688   -.1319937
                     5281  |  -.3116242   .0747387    -4.17   0.000    -.4600618   -.1631867
                     5282  |  -.5408064   .0747387    -7.24   0.000     -.689244   -.3923688
                     5307  |  -.8391265   .0747387   -11.23   0.000    -.9875641   -.6906889
                     5363  |   -.454757   .0747387    -6.08   0.000    -.6031946   -.3063195
                     5495  |   .3650371   .0747387     4.88   0.000     .2165995    .5134747
                     5518  |  -.6497876   .0747387    -8.69   0.000    -.7982252     -.50135
                     5653  |  -.2650597   .0747387    -3.55   0.001    -.4134972   -.1166221
                     5907  |  -.6053464   .0747387    -8.10   0.000     -.753784   -.4569088
                     5946  |  -.2824016   .0747387    -3.78   0.000    -.4308392    -.133964
                     6011  |  -.2313315   .0747387    -3.10   0.003    -.3797691   -.0828939
                     6035  |   -.022574   .0747387    -0.30   0.763    -.1710116    .1258636
                     6102  |    -.26037   .0747387    -3.48   0.001    -.4088076   -.1119324
                     6183  |  -.5272745   .0747387    -7.05   0.000    -.6757121   -.3788369
                     6199  |  -.1299688   .0747387    -1.74   0.085    -.2784064    .0184688
                     6314  |  -.1947172   .0747387    -2.61   0.011    -.3431548   -.0462796
                     6331  |  -.4574492   .0747387    -6.12   0.000    -.6058868   -.3090117
                     6429  |  -.3294341   .0747387    -4.41   0.000    -.4778717   -.1809965
                     6450  |  -.3470768   .0747387    -4.64   0.000    -.4955144   -.1986393
                     6484  |  -.1840058   .0747387    -2.46   0.016    -.3324434   -.0355682
                     6668  |   -.480616   .0747387    -6.43   0.000    -.6290536   -.3321784
                     6687  |  -.2195136   .0747387    -2.94   0.004    -.3679512    -.071076
                     6759  |   -.534215   .0747387    -7.15   0.000    -.6826526   -.3857774
                     6808  |  -.3382743   .0747387    -4.53   0.000    -.4867119   -.1898367
                     6816  |  -.5136693   .0747387    -6.87   0.000    -.6621069   -.3652317
                     6825  |  -.4847557   .0747387    -6.49   0.000    -.6331933   -.3363181
                     7098  |   .0711586   .0747387     0.95   0.344     -.077279    .2195962
                     7168  |  -.3845569   .0747387    -5.15   0.000    -.5329945   -.2361194
                     7175  |  -.1488839   .0747387    -1.99   0.049    -.2973215   -.0004464
                     7351  |  -.3287382   .0747387    -4.40   0.000    -.4771758   -.1803006
                     7381  |  -.6923947   .0747387    -9.26   0.000    -.8408323   -.5439571
                     7411  |  -.0169957   .0747387    -0.23   0.821    -.1654333    .1314419
                     7739  |  -.3678238   .0747387    -4.92   0.000    -.5162614   -.2193862
                     7848  |   -.557927   .0747387    -7.47   0.000    -.7063646   -.4094894
                           |
                     _cons |   .3300108   .0528483     6.24   0.000     .2250496     .434972

        Comment


        • #19
          I would just advise you to scrap this model. You have 89 predictors and 192 observations It's useless.

          Even if you had a much larger corpus of data, it doesn't really make sense to model time as 89 discrete time points. No one will ever be able to make any sense out of the results. Better is to treat time as a continuous variable. Now, you need to pick an appropriate way to do that. Is your outcome likely to be linearly related to the time interval? Or some curvilinear relationship? U-shaped? Undulating with several peaks and valleys? Piecewise linear?

          If there is no theory to guide this, then I would start with -lowess delta_log_price days_between_sales- and see what the smoothed relationship looks like, and then pick a specification for your regression that would reasonably capture that.

          There is another problem here. You have reduced the data to matched pairs (same house before and after), but you are including both members of each matched pair in the analysis even though the variables are the same for both members! So all of your data is double counted. So you need to do:

          [code]
          egen flag = tag(HOUSE_ID)
          regress delta_log_price days_between_sales_or_whatever_transform(s)_you_se ttle_on if flag
          [code]
          so as to only represent each pair once.

          Once you get a simpler model and correct the estimation sample in these ways, I think you will have a much more tractable set of results to try to interpret.

          I would ignore the sums of squares and mean squares. They are of interest in ANOVA, but this is a regression model with continuous variables; the SS and MS statistics don't really help understand what's going on in this context and are primarily of historical interest.

          Comment


          • #20
            Thanks, i managed to get the time format fixed by saving my excel file as an older version of excel, which state then accepted.
            Thanks for all your help Clyde, it has been very insightful!
            You can now close the thread.

            Comment

            Working...
            X