Announcement

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

  • How do I create this specific table?

    Dear all,

    I am a Stata newbie and I would like to create the table as shown in the picture below for my own data. All the variables in the table are similar to my own. Could someone explain which code to use or how I could create the table with the dropdown menus? Thanks in advance



    .
    Click image for larger version

Name:	Schermafbeelding 2023-04-27 143841.png
Views:	1
Size:	141.9 KB
ID:	1711463

    Last edited by Damian Rozenberg; 27 Apr 2023, 06:53.

  • #2
    Hey Damian,

    it would be good if you can provide us with some example data such that we better understand what you are aiming for (you can use dataex from SSC for that).

    Anyway, in principle you are looking for something like this:

    Code:
    ttest var1 var2 ..., by(positive_first_day)
    If you want to export the table afterwards you can use estout or esttab from SSC.

    Best regards
    Sebastian

    Comment


    • #3
      Hi Sebastian,

      Thanks for your reply! I included a part of my data below (at the bottom) to give you some information. The 'InitialReturnDummy' regards the Positive and Negative returns (columns) in the example table, so the dummy takes on a value of 1 if the first-day returns are negative and 0 otherwise. So, what I would to test is whether the variables like offer price and deal size differ between IPOs that have a positive/negative first-day return. However, if i try the esstab/estout command it gives me the following error:

      Code:
      . ttest NewIssuesOfferPrice, by(Initialreturndummy)
      
      Two-sample t test with equal variances
      ------------------------------------------------------------------------------
         Group |     Obs        Mean    Std. err.   Std. dev.   [95% conf. interval]
      ---------+--------------------------------------------------------------------
             0 |     366    12.36772     .944806     18.0752    10.50977    14.22567
             1 |     152    12.30187    1.147697    14.14976    10.03425    14.56949
      ---------+--------------------------------------------------------------------
      Combined |     518     12.3484    .7471127      17.004    10.88065    13.81615
      ---------+--------------------------------------------------------------------
          diff |            .0658474    1.642379               -3.160724    3.292419
      ------------------------------------------------------------------------------
          diff = mean(0) - mean(1)                                      t =   0.0401
      H0: diff = 0                                     Degrees of freedom =      516
      
          Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
       Pr(T < t) = 0.5160         Pr(|T| > |t|) = 0.9680          Pr(T > t) = 0.4840
      
      . 
      end of do-file
      
      . do "C:\Users\damia\AppData\Local\Temp\STD5fd0_000000.tmp"
      
      . estout
      last estimates (.) not found
      r(301);

      Code:
      input float Initialreturndummy double(NewIssuesOfferPrice Dealsizeinmillions) float Hotnessdummy
      0            12.41 .024820000000000002 1
      0 20.6006014434643   556.2234491840412 1
      0               41  367.79041800000005 0
      1             15.5  14.999985500000001 0
      0            10.15        862.84702385 0
      1                9           47.836134 0
      0              4.3              .03956 0
      0              5.6               88.48 0
      0               34  56.197376000000006 0
      0               28             1178.52 1
      0               54                 243 1
      0               40   889.9875999999999 1
      0             32.5            1113.775 0
      0 33.1606927205636    74.4510940291933 0
      0                7  22.999990999999998 0
      0              7.5                34.5 0
      1             8.05   7.892622500000001 0
      1               19           86.340883 0
      0             22.3         100.3686874 0
      0              3.2               57.04 0
      0             1.85                92.5 0
      1               33  7129.6296059999995 0
      0              4.9   768.3200000000002 0
      0             22.2         349.7483904 0
      0 8.20597071161237   106.6776192509608 0
      1             14.4   4.680000000000001 0
      1            10.25         326.8788755 0
      1             16.4           75.333154 1
      0            19.75        992.29318675 1
      0               80  1199.5098400000002 1
      0            12.73   5.121240810000001 1
      0             7.75  103.52809599999999 1
      0               15              293.25 1
      0             7.13   9.678746839999999 1
      0                9                 9.9 1
      1             20.5          603.417172 1
      1               12                 510 1
      0               17  1368.2883160000001 1
      0               31                  62 1
      0               19          619.454245 1
      1              7.7   5.746894999999999 1
      0               10                12.6 1
      0 28.1803323875152   44.49857656149169 1
      1            11.75              23.265 1
      0              7.5           25.300005 1
      1               16                 296 1
      0              9.2   6.583501599999999 1
      0              4.5  38.500001999999995 1
      0             20.3            11.00463 1
      0             10.2                8.67 1
      0 10.8497895535776   72.69359000896992 1
      1             4.64  23.362399999999997 1
      0               19   852.8625000000001 1
      0               10                  20 1
      0               36  40.773959999999995 1
      0                9  21.599999999999998 1
      0              2.1            113.7381 1
      0                8              286.32 1
      0              8.5         106.1416675 1
      0                3           38.600001 1
      0              1.8              145.98 1
      0               17               55.25 1
      0               12              109.92 1
      0                9  15.035058000000001 1
      0              5.6  27.299999999999997 0
      0             14.5           89.777794 0
      1             9.25              5.0875 0
      1               15                   9 0
      1             16.5  1167.4671524999999 0
      0              7.5  15.525000000000002 0
      0              4.5                 126 0
      0              6.5   860.7776254999999 0
      0              1.6              121.88 0
      0                4                 184 0
      0            10.51   46.44296481000001 0
      1            10.25             11.3119 0
      0               42           24.406242 0
      0             15.5   76.99998550000001 0
      0 24.7707491375062  44.866019375308106 0
      0               24  360.58716000000004 0
      0               47              242.52 0
      1            19.35  258.22954260000006 0
      1             1.05  24.150000000000002 0
      0            12.35             25.6386 0
      1          6.60159     434.96907396588 0
      1            10.25          271.298476 0
      0             5.25            3894.975 0
      0               18              22.824 0
      0             34.5            185.0925 0
      0               21          249.028815 0
      1  8.0754027792941  57.659627531590665 0
      1 .760823137847083  2.2139953311350116 0
      0                7           86.250003 0
      0 5.40808591282375  175.22198357548947 0
      1             9.25  104.48064624999999 0
      1             17.5                31.5 0
      1               17   94.97389999999999 0
      0              2.8               311.5 0
      1              9.6         186.7944288 0
      0   2.426710608914  441.17710013402404 0

      Comment


      • #4
        Hey Damian,

        sorry for the late reply. You need to store the estimates before you run the estout. This is one way to do so:

        Code:
        estpost ttest NewIssuesOfferPrice, by(Initialreturndummy)
        
        estout, cells("mu_2(fmt(2)) sd_2(fmt(2)) mu_1(fmt(2)) sd_1(fmt(2))  t(fmt(2)) p(fmt(2))")  mlabels(none) starlevels(* 0.10 ** 0.05 *** 0.01)
        While in theory that would provide you the content for the table you are looking for, estpost does not store sd_1 and sd_2 that ttest produces. From the top of my mind, I have no solution for this.

        Best
        Sebastian
        Last edited by Sebastian Schirner; 03 May 2023, 01:38.

        Comment

        Working...
        X