Computing p-values for test statisticsSuppose a test statistic has a t-distribution with k degrees of freedom. For a two-tailed test, the p-value is computed as:
p = 2 P(tk > |tstat|)
where To get some further insight into how the computation is done, the
ExampleThis example uses the Griffiths, Hill and Judge data set on household expenditure for food. The OLS estimation results for the food expenditure relationship can be reviewed. The SHAZAM program (filename:
The commands show a number of useful features of SHAZAM programming. The following steps should be noted:
The SHAZAM output follows. Note that
|_SAMPLE 1 40
|_READ (GHJ.txt) FOOD INCOME
UNIT 88 IS NOW ASSIGNED TO: GHJ.txt
2 VARIABLES AND 40 OBSERVATIONS STARTING AT OBS 1
|_* Save the t-ratios from the OLS regression in the variable TR
|_OLS FOOD INCOME / TRATIO=TR
OLS ESTIMATION
40 OBSERVATIONS DEPENDENT VARIABLE = FOOD
...NOTE..SAMPLE RANGE SET TO: 1, 40
R-SQUARE = .3171 R-SQUARE ADJUSTED = .2991
VARIANCE OF THE ESTIMATE-SIGMA**2 = 46.853
STANDARD ERROR OF THE ESTIMATE-SIGMA = 6.8449
SUM OF SQUARED ERRORS-SSE= 1780.4
MEAN OF DEPENDENT VARIABLE = 23.595
LOG OF THE LIKELIHOOD FUNCTION = -132.672
VARIABLE ESTIMATED STANDARD T-RATIO PARTIAL STANDARDIZED ELASTICITY
NAME COEFFICIENT ERROR 38 DF P-VALUE CORR. COEFFICIENT AT MEANS
INCOME .23225 .5529E-01 4.200 .000 .563 .5631 .6871
CONSTANT 7.3832 4.008 1.842 .073 .286 .0000 .3129
|_* Save the degrees of freedom in the variable DF
|_GEN1 DF1=$DF
..NOTE..CURRENT VALUE OF $DF = 38.000
|_* Set the sample period to the number of estimated coefficients
|_SAMPLE 1 2
|_* Take the absolute value of the t-ratios.
|_GENR TRA=ABS(TR)
|_* Use the DISTRIB command - save the CDF in the variable CDF1
|_DISTRIB TRA / TYPE=T DF=DF1 CDF=CDF1
T DISTRIBUTION DF= 38.000
VARIANCE= 1.0556 H= 1.0000
DATA PDF CDF 1-CDF
TRA
ROW 1 4.2004 .23351E-03 .99992 .77568E-04
ROW 2 1.8420 .74782E-01 .96335 .36648E-01
|_* Get the p-value for a 2-sided test.
|_GENR PVAL2=2*(1-CDF1)
|_*
|_* Now get p-values for 1-sided tests.
|_DISTRIB TR / TYPE=T DF=DF1 CDF=CDF1
T DISTRIBUTION DF= 38.000
VARIANCE= 1.0556 H= 1.0000
DATA PDF CDF 1-CDF
TR
ROW 1 4.2004 .23351E-03 .99992 .77568E-04
ROW 2 1.8420 .74782E-01 .96335 .36648E-01
|_* H0: coefficient > 0 vs. H1: coefficient < 0
|_GENR PA=CDF1
|_* H0: coefficient < 0 vs. H1: coefficient > 0
|_GENR PB=1-CDF1
|_*
|_* Print the results
|_PRINT TR PVAL2 PA PB
TR PVAL2 PA PB
4.200378 .1551364E-03 .9999224 .7756820E-04
1.841956 .7329593E-01 .9633520 .3664796E-01
|_STOP
[SHAZAM Guide home]
|