RUNTEST Procedure |
@RUNTEST does a "run test" for an input series which shows two states (0 and 1). It tests whether the series appears to be sequentially independent versus the alternative that there are longer than expected runs of single states.
@RunTest( options ) series start end
Parameters
|
series |
series to analyze |
|
start, end |
range of series to use. By default, the defined range of series. |
Options
[ESTIMATE]/NOESTIMATE
Indicates whether the prob(success) should be estimated or input
PI=input probability of 1 [.5]
Used if NOESTIMATE.
[PRINT]/NOPRINT
TITLE="title for output" ["Run Test for Series ...."]
Variables Defined
|
%CDSTAT |
test statistic for independence (REAL) |
|
%SIGNIF |
significance level of independence test (REAL) |
Example
*
* Gujarati, Basic Econometrics, 4th edition
* Examples from section 12.6, pages 462-474
*
open data table12-4.prn
cal 1959
data(format=prn,org=columns) 1959:1 1998:1
linreg y / resids
# constant x
set sres = resids/sqrt(%seesq)
graph(overlay=line) 2
# resids
# sres
*
set logy = log(y)
set logx = log(x)
linreg logy / lresids
# constant logx
*
set plus = (resids>=0.0)
set minus = (resids<0.0)
*
@RunTest plus
Sample Output
This is the output from the example. 52.5% of the observations are "plus". However, there are only 3 runs, so the signs are very persistent, leading to the strong rejection of independence.
Run Test for Series PLUS
Observations 40
Runs 3
Prob(success) 0.525
Z-score -5.189
P-value 0.0000
Copyright © 2026 Thomas A. Doan