Announcement

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

  • Descriptive Statistics incl. Ex.Kurtosis and Skewness + Switch columns and rows

    Dear Community,

    I would like to create a descriptive statistics table for eleven variables: ME, BM, OP, INV, ME_w, BM_w, OP_w, INV_w, ln_ME, ln_BM, ln_INV.
    The "_w" indicates that the variable has been winsorized, while "ln_" indicates that they have been transformed with the ln function.
    I would like generate the following statistics: mean, std, min, max, median, excess kurtosis, skewness, non-missing observations.

    I have two obstacles:
    1. I cannot manage to obtain kurtosis without the "detail" option of the summarize function, which creates a variable for each variable for itself.
    2. I would like to have the variables in the top row and the statistics in columns.

    Is there an easy way or package to accomplish this? I would expect that this is often required by researchers.

    Please find a short excerpt of the data below.
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float ID str8 date float(ME BM OP INV ME_w BM_w OP_w INV_w ln_ME ln_BM ln_INV)
    1 "19870130" 1581.5313 .21094427 -1.562201           . 1581.5313 .21094427 -1.562201           .  7.366149 -1.5561613            .
    1 "19870227" 1581.5313 .21094427 -1.562201           . 1581.5313 .21094427 -1.562201           .  7.366149 -1.5561613            .
    1 "19870331"    973.25 .21094427 -1.562201           .   1335.75 .21094427 -1.562201           .  7.197248 -1.5561613            .
    1 "19870430"  912.4413 .21094427 -1.562201           .   1335.75 .21094427 -1.562201           .  7.197248 -1.5561613            .
    1 "19870529"  851.5938 .21094427 -1.562201           .   1335.75 .21094427 -1.562201           .  7.197248 -1.5561613            .
    1 "19870630"         . .21094427 -1.562201           .         . .21094427 -1.562201           .         . -1.5561613            .
    2 "19870130"   6689.25 1.0144155  .2221115           .   6689.25 1.0144155  .2221115           .  8.808257 .014312587            .
    2 "19870227"   6193.75 1.0144155  .2221115           .   6193.75 1.0144155  .2221115           .  8.731296 .014312587            .
    2 "19870331"  6317.625 1.0144155  .2221115           .  6317.625 1.0144155  .2221115           .  8.751099 .014312587            .
    2 "19870430"  6069.875 1.0144155  .2221115           .  6069.875 1.0144155  .2221115           .  8.711093 .014312587            .
    2 "19870529"  5636.313 1.0144155  .2221115           .  5636.313 1.0144155  .2221115           .  8.636986 .014312587            .
    2 "19870630"  5822.125 1.0144155  .2221115           .  5822.125 1.0144155  .2221115           .   8.66942 .014312587            .
    2 "19870731"      5946 1.0144155  .2221115           .      5946 1.0144155  .2221115           .  8.690474 .014312587            .
    2 "19870831"    6441.5 1.0144155  .2221115           .    6441.5 1.0144155  .2221115           .  8.770516 .014312587            .
    2 "19870930"      6200 1.0144155  .2221115           .      6200 1.0144155  .2221115           .  8.732305 .014312587            .
    2 "19871030"      6324 1.0144155  .2221115           .      6324 1.0144155  .2221115           .  8.752108 .014312587            .
    2 "19871130"      6138 1.0144155  .2221115           .      6138 1.0144155  .2221115           .  8.722254 .014312587            .
    2 "19871231"      5828 1.2074468  .2221115           .      5828 1.2074468  .2221115           .  8.670429  .18850806            .
    2 "19880129"      6200 1.2076184 .11082698  -.03847408      6200 1.2076184 .11082698  -.03847408  8.732305   .1886501   -.03923376
    2 "19880229"      6696 1.2076184 .11082698  -.03847408      6696 1.2076184 .11082698  -.03847408  8.809265   .1886501   -.03923376
    2 "19880331"      6076 1.2076184 .11082698  -.03847408      6076 1.2076184 .11082698  -.03847408  8.712102   .1886501   -.03923376
    2 "19880429"      6262 1.2076184 .11082698  -.03847408      6262 1.2076184 .11082698  -.03847408  8.742255   .1886501   -.03923376
    2 "19880531"      6386 1.2076184 .11082698  -.03847408      6386 1.2076184 .11082698  -.03847408  8.761864   .1886501   -.03923376
    2 "19880630"      6200 1.2076184 .11082698  -.03847408      6200 1.2076184 .11082698  -.03847408  8.732305   .1886501   -.03923376
    2 "19880729"      6386 1.2076184 .11082698  -.03847408      6386 1.2076184 .11082698  -.03847408  8.761864   .1886501   -.03923376
    2 "19880831"      6572 1.2076184 .11082698  -.03847408      6572 1.2076184 .11082698  -.03847408  8.790573   .1886501   -.03923376
    2 "19880930"   6362.25 1.2076184 .11082698  -.03847408   6362.25 1.2076184 .11082698  -.03847408  8.758138   .1886501   -.03923376
    2 "19881031"   6611.75 1.2076184 .11082698  -.03847408   6611.75 1.2076184 .11082698  -.03847408  8.796603   .1886501   -.03923376
    2 "19881130"   6611.75 1.2076184 .11082698  -.03847408   6611.75 1.2076184 .11082698  -.03847408  8.796603   .1886501   -.03923376
    2 "19881230"   6362.25 1.1062124 .11082698  -.03847408   6362.25 1.1062124 .11082698  -.03847408  8.758138  .10094191   -.03923376
    2 "19890131"      6487 1.1451924 .15248433 -.003058385      6487 1.1451924 .15248433 -.003058385  8.777555  .13557264 -.0030630715
    2 "19890228"    6736.5 1.1451924 .15248433 -.003058385    6736.5 1.1451924 .15248433 -.003058385  8.815296  .13557264 -.0030630715
    2 "19890331"    6736.5 1.1451924 .15248433 -.003058385    6736.5 1.1451924 .15248433 -.003058385  8.815296  .13557264 -.0030630715
    2 "19890428"    7235.5 1.1451924 .15248433 -.003058385    7235.5 1.1451924 .15248433 -.003058385  8.886755  .13557264 -.0030630715
    2 "19890531"      6986 1.1451924 .15248433 -.003058385      6986 1.1451924 .15248433 -.003058385  8.851664  .13557264 -.0030630715
    2 "19890630"      7007 1.1451924 .15248433 -.003058385      7007 1.1451924 .15248433 -.003058385  8.854665  .13557264 -.0030630715
    2 "19890731"   7257.25 1.1451924 .15248433 -.003058385   7257.25 1.1451924 .15248433 -.003058385  8.889756  .13557264 -.0030630715
    2 "19890831"   9259.25 1.1451924 .15248433 -.003058385   9259.25 1.1451924 .15248433 -.003058385  9.133378  .13557264 -.0030630715
    2 "19890929"  9043.625 1.1451924 .15248433 -.003058385  9043.625 1.1451924 .15248433 -.003058385  9.109816  .13557264 -.0030630715
    2 "19891031"    9680.5 1.1451924 .15248433 -.003058385    9680.5 1.1451924 .15248433 -.003058385  9.177869  .13557264 -.0030630715
    2 "19891130" 10062.625 1.1451924 .15248433 -.003058385 10062.625 1.1451924 .15248433 -.003058385  9.216583  .13557264 -.0030630715
    2 "19891229"  10347.75  .7041144 .15248433 -.003058385  10347.75  .7041144 .15248433 -.003058385  9.244524  -.3508144 -.0030630715
    2 "19900131" 10156.125  .8181489 .28384113    .5820197 10156.125  .8181489 .28384113    .5820197  9.225832   -.200711     .4587023
    2 "19900228"  10092.25  .8181489 .28384113    .5820197  10092.25  .8181489 .28384113    .5820197  9.219523   -.200711     .4587023
    2 "19900330" 10141.625  .8181489 .28384113    .5820197 10141.625  .8181489 .28384113    .5820197  9.224403   -.200711     .4587023
    2 "19900430" 10141.625  .8181489 .28384113    .5820197 10141.625  .8181489 .28384113    .5820197  9.224403   -.200711     .4587023
    2 "19900531"  10013.25  .8181489 .28384113    .5820197  10013.25  .8181489 .28384113    .5820197  9.211664   -.200711     .4587023
    2 "19900629"  10052.25  .8181489 .28384113    .5820197  10052.25  .8181489 .28384113    .5820197  9.215551   -.200711     .4587023
    2 "19900731"     10310  .8181489 .28384113    .5820197     10310  .8181489 .28384113    .5820197 9.2408695   -.200711     .4587023
    2 "19900831"    9794.5  .8181489 .28384113    .5820197    9794.5  .8181489 .28384113    .5820197  9.189576   -.200711     .4587023
    2 "19900928"     10179  .8181489 .28384113    .5820197     10179  .8181489 .28384113    .5820197  9.228082   -.200711     .4587023
    2 "19901031"   10048.5  .8181489 .28384113    .5820197   10048.5  .8181489 .28384113    .5820197 9.2151785   -.200711     .4587023
    2 "19901130"   10048.5  .8181489 .28384113    .5820197   10048.5  .8181489 .28384113    .5820197 9.2151785   -.200711     .4587023
    2 "19901231"     10013  .8455008 .28384113    .5820197     10013  .8455008 .28384113    .5820197  9.211639 -.16782613     .4587023
    2 "19910131"  10144.75  .9425746  .2632973  .017021276  10144.75  .9425746  .2632973  .017021276  9.224711 -.05914019   .016878037
    2 "19910228"   10276.5  .9425746  .2632973  .017021276   10276.5  .9425746  .2632973  .017021276  9.237615 -.05914019   .016878037
    2 "19910328"     10013  .9425746  .2632973  .017021276     10013  .9425746  .2632973  .017021276  9.211639 -.05914019   .016878037
    2 "19910430"  10408.25  .9425746  .2632973  .017021276  10408.25  .9425746  .2632973  .017021276  9.250354 -.05914019   .016878037
    2 "19910531"  10408.25  .9425746  .2632973  .017021276  10408.25  .9425746  .2632973  .017021276  9.250354 -.05914019   .016878037
    2 "19910628"   11266.5  .9425746  .2632973  .017021276   11266.5  .9425746  .2632973  .017021276  9.329589 -.05914019   .016878037
    2 "19910731" 10864.125  .9425746  .2632973  .017021276 10864.125  .9425746  .2632973  .017021276  9.293221 -.05914019   .016878037
    2 "19910830"   12339.5  .9425746  .2632973  .017021276   12339.5  .9425746  .2632973  .017021276  9.420561 -.05914019   .016878037
    2 "19910930"   12339.5  .9425746  .2632973  .017021276   12339.5  .9425746  .2632973  .017021276  9.420561 -.05914019   .016878037
    2 "19911031"     13949  .9425746  .2632973  .017021276     13949  .9425746  .2632973  .017021276  9.543163 -.05914019   .016878037
    2 "19911129"  15826.75  .9425746  .2632973  .017021276  15826.75  .9425746  .2632973  .017021276  9.669456 -.05914019   .016878037
    2 "19911231"   15587.5  .6054851  .2632973  .017021276   15587.5  .6054851  .2632973  .017021276  9.654224 -.50172526   .016878037
    2 "19920131"  14781.25  .6679069 .22985315   .03802767  14781.25  .6679069 .22985315   .03802767  9.601115  -.4036064    .03732244
    2 "19920228"     11825  .6679069 .22985315   .03802767     11825  .6679069 .22985315   .03802767  9.377972  -.4036064    .03732244
    2 "19920331"  12631.25  .6679069 .22985315   .03802767  12631.25  .6679069 .22985315   .03802767  9.443929  -.4036064    .03732244
    2 "19920430" 12765.625  .6679069 .22985315   .03802767 12765.625  .6679069 .22985315   .03802767  9.454512  -.4036064    .03732244
    2 "19920529"     12900  .6679069 .22985315   .03802767     12900  .6679069 .22985315   .03802767  9.464983  -.4036064    .03732244
    2 "19920630"  12631.25  .6679069 .22985315   .03802767  12631.25  .6679069 .22985315   .03802767  9.443929  -.4036064    .03732244
    2 "19920731"   13437.5  .6679069 .22985315   .03802767   13437.5  .6679069 .22985315   .03802767  9.505805  -.4036064    .03732244
    2 "19920831"     13975  .6679069 .22985315   .03802767     13975  .6679069 .22985315   .03802767  9.545025  -.4036064    .03732244
    2 "19920930"     16125  .6679069 .22985315   .03802767     16125  .6679069 .22985315   .03802767  9.688127  -.4036064    .03732244
    2 "19921030" 15721.875  .6679069 .22985315   .03802767 15721.875  .6679069 .22985315   .03802767  9.662808  -.4036064    .03732244
    2 "19921130" 15453.125  .6679069 .22985315   .03802767 15453.125  .6679069 .22985315   .03802767  9.645567  -.4036064    .03732244
    2 "19921231"     15120  .6885582 .22985315   .03802767     15120  .6885582 .22985315   .03802767  9.623774  -.3731555    .03732244
    2 "19930129"     15120  .7103835 .19476786   .13709874     15120  .7103835 .19476786   .13709874  9.623774  -.3419503    .12848006
    2 "19930226"     15390  .7103835 .19476786   .13709874     15390  .7103835 .19476786   .13709874  9.641473  -.3419503    .12848006
    2 "19930331"  15318.75  .7103835 .19476786   .13709874  15318.75  .7103835 .19476786   .13709874  9.636833  -.3419503    .12848006
    2 "19930430"  16393.75  .7103835 .19476786   .13709874  16393.75  .7103835 .19476786   .13709874  9.704656  -.3419503    .12848006
    2 "19930528" 16259.375  .7103835 .19476786   .13709874 16259.375  .7103835 .19476786   .13709874  9.696424  -.3419503    .12848006
    2 "19930630"     17985  .7103835 .19476786   .13709874     17985  .7103835 .19476786   .13709874  9.797294  -.3419503    .12848006
    2 "19930730"  17848.75  .7103835 .19476786   .13709874  17848.75  .7103835 .19476786   .13709874  9.789689  -.3419503    .12848006
    2 "19930831"  17303.75  .7103835 .19476786   .13709874  17303.75  .7103835 .19476786   .13709874  9.758678  -.3419503    .12848006
    2 "19930930"  18274.25  .7103835 .19476786   .13709874  18274.25  .7103835 .19476786   .13709874  9.813249  -.3419503    .12848006
    2 "19931029"  18819.75  .7103835 .19476786   .13709874  18819.75  .7103835 .19476786   .13709874  9.842662  -.3419503    .12848006
    2 "19931130"     18547  .7103835 .19476786   .13709874     18547  .7103835 .19476786   .13709874  9.828063  -.3419503    .12848006
    2 "19931231" 20047.125  .5357875 .19476786   .13709874 20047.125  .5357875 .19476786   .13709874  9.905841  -.6240176    .12848006
    2 "19940131"   19092.5 .57344884 .26696247   .23099707   19092.5 .57344884 .26696247   .23099707  9.857051 -.55608654    .20782447
    2 "19940228"   19092.5 .57344884 .26696247   .23099707   19092.5 .57344884 .26696247   .23099707  9.857051 -.55608654    .20782447
    2 "19940331"  18819.75 .57344884 .26696247   .23099707  18819.75 .57344884 .26696247   .23099707  9.842662 -.55608654    .20782447
    2 "19940429"  16092.25 .57344884 .26696247   .23099707  16092.25 .57344884 .26696247   .23099707  9.686093 -.55608654    .20782447
    2 "19940531"  17183.25 .57344884 .26696247   .23099707  17183.25 .57344884 .26696247   .23099707   9.75169 -.55608654    .20782447
    2 "19940630" 18897.375 .57344884 .26696247   .23099707 18897.375 .57344884 .26696247   .23099707  9.846778 -.55608654    .20782447
    2 "19940729"  20266.75 .57344884 .26696247   .23099707  20266.75 .57344884 .26696247   .23099707  9.916737 -.55608654    .20782447
    2 "19940831"     19719 .57344884 .26696247   .23099707     19719 .57344884 .26696247   .23099707  9.889338 -.55608654    .20782447
    2 "19940930"  20451.75 .57344884 .26696247   .23099707  20451.75 .57344884 .26696247   .23099707  9.925824 -.55608654    .20782447
    2 "19941031"  19346.25 .57344884 .26696247   .23099707  19346.25 .57344884 .26696247   .23099707  9.870254 -.55608654    .20782447
    end

    Best regards and many thanks in advance,
    John

  • #2
    Code:
    search kurtosis
    points high up to

    Code:
    help tabstat
    It won't directly support your preference to subtract 3 from kurtosis, but there are other ways to do that.

    Comment

    Working...
    X