/* NIST StRD benchmark from http://www.nist.gov/itl/div898/strd/

Univariate Summary Statistics

Difficulty=Lower N=200 Observed

File Name:     lew.dat

Dataset Name:  Beam Deflections

Description:   This is an observed/"real world" data set
               consisting of 200 deflections of a steel-concrete
               beam while subjected to periodic pressure.
               The experimenter was H. S. Lew of the
               Center for Building Technology at NIST.
               We here use this data to test accuracy
               in summary statistics calculations.

Stat Category: Univariate: Summary Statistics

Reference:     None

Data:          "Real World"
               1    Response          : y = beam deflection
               0    Predictors
               200  Observations

Model:         Lower Level of Difficulty
               2    Parameters        : mu, sigma
               1    Response Variable : y
               0    Predictor Variables

               y    = mu + e

                                                  Certified Values
Sample Mean                                ybar:  -177.435000000000
Sample Standard Deviation (denom. = n-1)      s:   277.332168044316
Sample Autocorrelation Coefficient (lag 1) r(1):  -0.307304800605679

Number of Observations:                             200
*/

clear

scalar N    = 200
scalar mean = -177.435000000000
scalar sd   = 277.332168044316
scalar rho1 = -0.307304800605679

qui input int y
    -213
    -564
     -35
     -15
     141
     115
    -420
    -360
     203
    -338
    -431
     194
    -220
    -513
     154
    -125
    -559
      92
     -21
    -579
     -52
      99
    -543
    -175
     162
    -457
    -346
     204
    -300
    -474
     164
    -107
    -572
      -8
      83
    -541
    -224
     180
    -420
    -374
     201
    -236
    -531
      83
      27
    -564
    -112
     131
    -507
    -254
     199
    -311
    -495
     143
     -46
    -579
     -90
     136
    -472
    -338
     202
    -287
    -477
     169
    -124
    -568
      17
      48
    -568
    -135
     162
    -430
    -422
     172
     -74
    -577
     -13
      92
    -534
    -243
     194
    -355
    -465
     156
     -81
    -578
     -64
     139
    -449
    -384
     193
    -198
    -538
     110
     -44
    -577
      -6
      66
    -552
    -164
     161
    -460
    -344
     205
    -281
    -504
     134
     -28
    -576
    -118
     156
    -437
    -381
     200
    -220
    -540
      83
      11
    -568
    -160
     172
    -414
    -408
     188
    -125
    -572
     -32
     139
    -492
    -321
     205
    -262
    -504
     142
     -83
    -574
       0
      48
    -571
    -106
     137
    -501
    -266
     190
    -391
    -406
     194
    -186
    -553
      83
     -13
    -577
     -49
     103
    -515
    -280
     201
     300
    -506
     131
     -45
    -578
     -80
     138
    -462
    -361
     201
    -211
    -554
      32
      74
    -533
    -235
     187
    -372
    -442
     182
    -147
    -566
      25
      68
    -535
    -244
     194
    -351
    -463
     174
    -125
    -570
      15
      72
    -550
    -190
     172
    -424
    -385
     198
    -218
    -536
      96
end

summarize y
assert scalar(N) == r(N)

lrecomp r(mean) mean sqrt(r(Var)) sd

gen time = _n
tsset time
corrgram y, lag(1)

lrecomp r(ac1) rho1