-
Notifications
You must be signed in to change notification settings - Fork 0
/
BPtest.MAC
42 lines (36 loc) · 853 Bytes
/
BPtest.MAC
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
##
## ==================================================
## Breusch-Pagan Test
## Minitab Macro Function by Chanseok Park
## (MTHSC 805-Clemson University, IE-68722-PNU)
##
## Usage: We assume:
## c11 = response
## c1-c4 = predictors
##
## MTB > %U:\mthsc805\minitab\BPtest c11 c1-c4.
##
## ==================================================
MACRO
BPtest Y X.1-X.M .
MCONSTANT k1 k2 k3 N
MCOLUMN X.1-X.M Y E1 E2 E3
brief 0
let N = count(Y)
regress Y M X.1-X.M;
resids E1.
let E2 = E1**2
let k1 = mean(E2)
let k3 = M
regress E2 M X.1-X.M;
fits E3.
let k2 = (sum((E3-k1)**2)/2) / ((sum(E2)/N)**2)
cdf k2 k1;
chisquare k3.
let k1 = 1 - k1
brief 1
print "Breusch-Pagan Test Statistic:" k2 &
"Degrees of Freedom:" k3 &
"p-value:" k1 ;
format (A30, F12.5, /, A28, F8.0, /, A30, F12.5 ).
ENDMACRO