I want to create a graph with upper/lower bound bands - using this code (similar to that used here UCLA):
Code:
gen ub_totasset = totasset + invttail(n_totasset-1,0.025)*(sd_totasset / sqrt(n_totasset))
gen lb_totasset = totasset - invttail(n_totasset-1,0.025)*(sd_totasset / sqrt(n_totasset))
Can anyone see why I have these extreme values?
Code:
. su lb_* ub_*

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
 lb_totasset |        416   -307896.7     3712348  -5.26e+07    1960560
 ub_totasset |        416     2372561     4479745   38296.79   6.41e+07
Not observed in the original variable:

Code:
. su totasset

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
    totasset |     23,974     1065825     1426499          0   1.13e+07
A summary of variables obtained in collapse:
Code:
. su x_* sd_* n_*

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
  x_totasset |        466     1070203    991320.6       9000   1.13e+07
 sd_totasset |        416     1013592    866838.8   6737.313    6493558
  n_totasset |        466    51.44635    95.09399          1        527
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte wave float(x_totasset sd_totasset) long n_totasset
 2 129732.06 169859.94  16
 6 201348.75 253410.86  36
10 219802.66  267251.1  59
14 300747.13  818999.9  79
18    329523  812609.5  99
 2  205792.2 173246.14  32
 6  345172.3    452370  28
10  451610.9  462060.3  56
14  426897.3  401377.7 113
18  448629.9  628556.4 137
 2 605284.06  423648.2  18
 6  932561.8  779593.8  23
10 1148994.4 1069940.9  39
14   1264636   1123027  43
18 1300110.8 1713850.6  51
 2 1085281.9 600395.94   8
 6 2038759.4   2733372  12
10 1355813.5 1182220.9  28
14   2077544   2474082  34
18   2258062 2142515.5  47
 2    399992  214805.5   4
 6 1331786.8   1252303   4
10    411600         .   1
14 2490086.8 1430295.4   4
18   2215829   2517184   5
 2   1054135 1086901.3   6
 6 611310.75  421523.3   4
10 1631133.3 1190610.3   4
14    509000         .   1
18 2175171.3 1297562.6   4
 2  777162.2  944555.6   5
 6 2058610.8   3244880  10
10  952192.4 1281212.6  12
14 1685023.6   1416179  14
18 1825535.3 1669463.8   9
end
Stata v.15.1. Using panel data.