AreaRoutines.doc 1/28/05

Copies of the Area Routines

NormArea5C

GMacro

NormArea5c # For Release 14 - Controls NormArea5

#C1 contains means, C2 contains standard deviations

#C3 contains lower limits of intervals, C4 contains upper limits of intervals

#C5 contains 0 if Area is between points in C3 and C4

#C5 contains 1 if Area is to the left of point in c4

#C6 contains 2 if Area is to the right of point in C3

let K1 = Count(c1)

Do K2 = 1:K1

let C6(1) = C1(K2)

let C6(2) = C2(K2)

let C6(3) = C3(K2)

let C6(4) = C4(K2)

let C6(5) = C5(K2)

%NormArea5

EndDo

EndMacro

NormArea5

GMacro

NormArea5 # For Release 14 - low density version of NormArea3

# Originally written by Jon Cryer:

#Note Graphic display of normal curve areas

#Note Finds and displays areas to the left or right of a given value

#Note or between two values. (This macro uses C100-C116 and K100-K116)

#Note

#Note Enter the mean and standard deviation of the normal curve.

#Set c100;

#file 'terminal';

#NObs 2.

#In this version, input data is in C6 - mean, std. dev., lower limit, upper limit,

# c6(5) is 0 if Area is between C6(3) and C6(4)

# c6(5) is 1 if Area is to the left of C6(4)

# c6(5) is 2 if Area is to the right of C6(3)

Let C100(1)= c6(1)

Let C100(2)= c6(2)

Let K100 = C100(1)

Let K101 = C100(2)

Let K115 = C6(5)

#Note

#Note Do you want the area to the left of a value? (Y or N)

#YesNo K115

If K115 = 1

Call Left

#Note Do you want the area to the right of a value? (Y or N)

#YesNo K115

#If K115 = 1

#Let K115 = 2

EndIf

If K115 = 2

Call Right

EndIf

If K115 = 0

Call Between

EndIf

Erase C100-C116 K100-K116

EndMacro

GMacro # Want area to the left

Left

Note

#Note Enter the value for which you want the area to the left.

#Set c100;

#file 'terminal';

#NObs 1.

Let c100(1) = c6(4)

Note

Note ...working...

Let K102 = C100(1)

Let K103 = K100-4*K101

let K104 = K100+4*K101

Let K105 = .01*K101

Set C101

K103:K104/K105

End

PDF C101 C102;

Normal K100 K101.

Set C103

K103:K102/K105

End

Let K114 = N(C103)

Let C103(K114) = K102

PDF C103 C104;

Normal K100 K101.

CDF K102 C106; # Get area to report

Normal K100 K101.

Text C106 C106; # Convert to text for labeling

decimal 4.

Let K109 = C106

Let C107 = K102

Text C107 C107

Let K107 = C107

Let K110 = "The Area to the Left of "

KKCAT K110 K107 K112

Let K111 = " is "

KKCAT K112 K111 K112

KKCAT K112 K109 K112

# Get mean and stdev labeling

Let C108 = K100

Text C108 C108

Let K103 = C108 # Mean as text

Let C109 = K101

Text C109 C109

Let K104 = C109 # Stdev as text

Let K105 = "Normal Curve with Mean "

Let K106 = " and Standard Deviation "

KKCAT K105 K103 K111

KKCAT K111 K106 K111

KKCAT K111 K104 K111

Let K113 = -0.01/K101 # Set marker placement a little below zero

Plot C102*C101 C104*C103;

NoLegend;

WTitle "Normal Curve Area";

Title K111;

Title K112;

Connect;

Size 2;

Color 1;

Area;

Type 0 1;

Color 1 4;

AXLabel 1 "Data Axis";

AXLabel 2 "Density";

Marker K102 K113;

Type 19;

Color 1;

Size 2.0;

Scale 2;

Min 0;

Overlay.

Return

EndMacro

GMacro # Want area to the right

Right

#Note

#Note Enter the value for which you want the area to the right.

#Set c100;

#file 'terminal';

#NObs 1.

Let c100(1) = c6(3)

Note

Note ...working...

Let K102 = C100(1)

Let K103 = K100-4*K101

let K104 = K100+4*K101

Let K105 = .01*K101

Set C101

K103:K104/K105

End

PDF C101 C102;

Normal K100 K101.

Set C103

K102:K104/K105

End

Let K114 = N(C103)

Let C103(K114) = K104

PDF C103 C104;

Normal K100 K101.

CDF K102 C106; # Get area to report

Normal K100 K101.

Let C106 = 1 - C106

Text C106 C106; # Convert to text for labeling

decimal 4.

Let K109 = C106

Let C107 = K102

Text C107 C107

Let K107 = C107

Let K110 = "The Area to the Right of "

KKCAT K110 K107 K112

Let K111 = " is "

KKCAT K112 K111 K112

KKCAT K112 K109 K112

# Get mean and stdev labeling

Let C108 = K100

Text C108 C108

Let K103 = C108 # Mean as text

Let C109 = K101

Text C109 C109

Let K104 = C109 # Stdev as text

Let K105 = "Normal Curve with Mean "

Let K106 = " and Standard Deviation "

KKCAT K105 K103 K111

KKCAT K111 K106 K111

KKCAT K111 K104 K111

Let K113 = -0.01/K101 # Set marker placement a little below zero

Plot C102*C101 C104*C103;

NoLegend;

WTitle "Normal Curve Area";

Title K111;

Title K112;

Connect;

Size 2;

Color 1;

Area;

Type 0 1;

Color 1 4;

AXLabel 1 "Data Axis";

AXLabel 2 "Density";

Marker K102 K113;

Type 19;

Color 1;

Size 2.0;

Scale 2;

Min 0;

Overlay.

Return

EndMacro

GMacro # Want area between two values

Between

#Note

#Note Enter the two values for which you want the area between.

#Set c100;

#file 'terminal';

#NObs 2.

let c100(1)= c6(3)

let c100(2) = c6(4)

Note

Note ...working...

Let K102 = C100(1)

Let K115 = C100(2)

Let K103 = K100-4*K101

let K104 = K100+4*K101

Let K105 = .01*K101

Set C101

K103:K104/K105

End

PDF C101 C102; # Get values for full normal curve

Normal K100 K101.

Set C103

K102:K115/K105

End

Let K114 = N(C103)

Let C103(K114) = K115

PDF C103 C104;

Normal K100 K101.

CDF K102 C106; # Get area to report

Normal K100 K101.

CDF K115 C110;

Normal K100 K101.

Let C106 = C110-C106

Text C106 C106; # Convert area to text for labeling

decimal 4.

Let K109 = C106

Let C107 = K102 # Convert lower value to text

Text C107 C107

Let K107 = C107

Let C107 = K115

Text C107 C107 # Convert upper value to text

Let K116 = C107

Let K110 = "The Area Between "

Let K111 = " and "

Let K113 = " is "

KKCAT K110 K107 K112

KKCAT K112 K111 K112

KKCAT K112 K116 K112

KKCAT K112 K113 K112

KKCAT K112 K109 K112

# Get mean and stdev for labeling

Let C108 = K100

Text C108 C108

Let K103 = C108 # Mean as text

Let C109 = K101

Text C109 C109

Let K104 = C109 # Stdev as text

Let K105 = "Normal Curve with Mean "

Let K106 = " and Standard Deviation "

KKCAT K105 K103 K111

KKCAT K111 K106 K111

KKCAT K111 K104 K111

Let K113 = -0.01/K101 # Set marker placement a little below zero

Let K114 = -0.01/K101

Plot C102*C101 C104*C103;

NoLegend;

WTitle "Normal Curve Area";

Title K111;

Title K112;

Connect;

Color 1;

Size 2;

Area;

Type 0 1;

Color 1 4;

AXLabel 1 "Data Axis";

AXLabel 2 "Density";

Marker K102 K113;

Type 19;

Color 1;

Size 2.0;

Marker K115 K114;

Type 19;

Color 1;

Size 2.0;

Scale 2;

Min 0;

Overlay.

Return

EndMacro

NormArea5A

GMacro

NormArea5 # For Release 14 - low density version of NormArea3

# Originally written by Jon Cryer:

Note Graphic display of normal curve areas

Note Finds and displays areas to the left or right of a given value

Note or between two values. (This macro uses C100-C116 and K100-K116)

Note

Note Enter the mean and standard deviation of the normal curve.

Set c100;

file 'terminal';

NObs 2.

# In this version, input data is in C6 - mean, std. dev., lower limit, upper limit,

# c6(5) is 0 if Area is between C6(3) and C6(4)

# c6(5) is 1 if Area is to the left of C6(4)

# c6(5) is 2 if Area is to the right of C6(3)

#Let C100(1)= c6(1)

#Let C100(2)= c6(2)

Let K100 = C100(1)

Let K101 = C100(2)

#Let K115 = C6(5)

Note

Note Do you want the area to the left of a value? (Y or N)

YesNo K115

If K115 = 1

Call Left

EndIf

If K115 = 1

Goto 1

EndIf

Note Do you want the area to the right of a value? (Y or N)

YesNo K115

If K115 = 1

Let K115 = 2

EndIf

If K115 = 2

Call Right

EndIf

If K115 = 0

Call Between

EndIf

Mlabel 1

Erase C100-C116 K100-K116

EndMacro

GMacro # Want area to the left

Left

Note

Note Enter the value for which you want the area to the left.

Set c100;

file 'terminal';

NObs 1.

#Let c100(1) = c6(4)

Note

Note ...working...

Let K102 = C100(1)

Let K103 = K100-4*K101

let K104 = K100+4*K101

#In Cryer's original version k105 was .001*k101

Let K105 = .01*K101

Set C101

K103:K104/K105

End

PDF C101 C102;

Normal K100 K101.

Set C103

K103:K102/K105

End

Let K114 = N(C103)

Let C103(K114) = K102

PDF C103 C104;

Normal K100 K101.

CDF K102 C106; # Get area to report

Normal K100 K101.

Text C106 C106; # Convert to text for labeling

decimal 4.

Let K109 = C106

Let C107 = K102

Text C107 C107

Let K107 = C107

Let K110 = "The Area to the Left of "

KKCAT K110 K107 K112

Let K111 = " is "

KKCAT K112 K111 K112

KKCAT K112 K109 K112

# Get mean and stdev labeling

Let C108 = K100

Text C108 C108

Let K103 = C108 # Mean as text

Let C109 = K101

Text C109 C109

Let K104 = C109 # Stdev as text

Let K105 = "Normal Curve with Mean "

Let K106 = " and Standard Deviation "

KKCAT K105 K103 K111

KKCAT K111 K106 K111

KKCAT K111 K104 K111

Let K113 = -0.01/K101 # Set marker placement a little below zero

Plot C102*C101 C104*C103;

NoLegend;

WTitle "Normal Curve Area";

Title K111;

Title K112;

Connect;

Size 2;

Color 1;

Area;

Type 0 1;

Color 1 4;

AXLabel 1 "Data Axis";

AXLabel 2 "Density";

Marker K102 K113;

Type 19;

Color 1;

Size 2.0;

Scale 2;

Min 0;

Overlay.

Return

EndMacro

GMacro # Want area to the right

Right

Note

Note Enter the value for which you want the area to the right.

Set c100;

file 'terminal';

NObs 1.

#Let c100(1) = c6(3)

Note

Note ...working...

Let K102 = C100(1)

Let K103 = K100-4*K101

let K104 = K100+4*K101

#In Cryer's original version k105 was .001*k101

Let K105 = .01*K101

Set C101

K103:K104/K105

End

PDF C101 C102;

Normal K100 K101.

Set C103

K102:K104/K105

End

Let K114 = N(C103)

Let C103(K114) = K104

PDF C103 C104;

Normal K100 K101.

CDF K102 C106; # Get area to report

Normal K100 K101.

Let C106 = 1 - C106

Text C106 C106; # Convert to text for labeling

decimal 4.

Let K109 = C106

Let C107 = K102

Text C107 C107

Let K107 = C107

Let K110 = "The Area to the Right of "

KKCAT K110 K107 K112

Let K111 = " is "

KKCAT K112 K111 K112

KKCAT K112 K109 K112

# Get mean and stdev labeling

Let C108 = K100

Text C108 C108

Let K103 = C108 # Mean as text

Let C109 = K101

Text C109 C109

Let K104 = C109 # Stdev as text

Let K105 = "Normal Curve with Mean "

Let K106 = " and Standard Deviation "

KKCAT K105 K103 K111

KKCAT K111 K106 K111

KKCAT K111 K104 K111

Let K113 = -0.01/K101 # Set marker placement a little below zero

Plot C102*C101 C104*C103;

NoLegend;

WTitle "Normal Curve Area";

Title K111;

Title K112;

Connect;

Size 2;

Color 1;

Area;

Type 0 1;

Color 1 4;

AXLabel 1 "Data Axis";

AXLabel 2 "Density";

Marker K102 K113;

Type 19;

Color 1;

Size 2.0;

Scale 2;

Min 0;

Overlay.

Return

EndMacro

GMacro # Want area between two values

Between

Note

Note Enter the two values for which you want the area between.

Set c100;

file 'terminal';

NObs 2.

#let c100(1)= c6(3)

#let c100(2) = c6(4)

Note

Note ...working...

Let K102 = C100(1)

Let K115 = C100(2)

Let K103 = K100-4*K101

let K104 = K100+4*K101

#In Cryer's original version k105 was .001*k101

Let K105 = .01*K101

Set C101

K103:K104/K105

End

PDF C101 C102; # Get values for full normal curve

Normal K100 K101.

Set C103

K102:K115/K105

End

Let K114 = N(C103)

Let C103(K114) = K115

PDF C103 C104;

Normal K100 K101.

CDF K102 C106; # Get area to report

Normal K100 K101.

CDF K115 C110;

Normal K100 K101.

Let C106 = C110-C106

Text C106 C106; # Convert area to text for labeling

decimal 4.

Let K109 = C106

Let C107 = K102 # Convert lower value to text

Text C107 C107

Let K107 = C107

Let C107 = K115

Text C107 C107 # Convert upper value to text

Let K116 = C107

Let K110 = "The Area Between "

Let K111 = " and "

Let K113 = " is "

KKCAT K110 K107 K112

KKCAT K112 K111 K112

KKCAT K112 K116 K112

KKCAT K112 K113 K112

KKCAT K112 K109 K112

# Get mean and stdev for labeling

Let C108 = K100

Text C108 C108

Let K103 = C108 # Mean as text

Let C109 = K101

Text C109 C109

Let K104 = C109 # Stdev as text

Let K105 = "Normal Curve with Mean "

Let K106 = " and Standard Deviation "

KKCAT K105 K103 K111

KKCAT K111 K106 K111

KKCAT K111 K104 K111

Let K113 = -0.01/K101 # Set marker placement a little below zero

Let K114 = -0.01/K101

Plot C102*C101 C104*C103;

NoLegend;

WTitle "Normal Curve Area";

Title K111;

Title K112;

Connect;

Color 1;

Size 2;

Area;

Type 0 1;

Color 1 4;

AXLabel 1 "Data Axis";

AXLabel 2 "Density";

Marker K102 K113;

Type 19;

Color 1;

Size 2.0;

Marker K115 K114;

Type 19;

Color 1;

Size 2.0;

Scale 2;

Min 0;

Overlay.

Return

EndMacro


tAreaC

GMacro

tAreaC # For Release 14 - Controls tArea

#C1 contains degrees of freedom, C2 contains zero

#C3 contains lower limits of intervals, C4 contains upper limits of intervals