GMacro
NormArea # For Release 14
# Written by Jon Cryer: Jon-Cryer@uiowa.edu
name c101 'x'
name c102 'f'
Note Graphic display of normal curve areas
Note Finds and displays areas to the left 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.
Let K100 = C100(1)
Let K101 = C100(2)
Note
Note Do you want the area to the left of a value? (Y or N)
YesNo K115
If K115 = 1
Call Left
Else
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.
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 "
# 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 "
Let K113 = -0.01/K101 # Set marker placement a little below zero
Plot C102*C101 C104*C103;
NoLegend;
WTitle "Normal Curve Area";
Connect;
Size 2;
Color 1;
Area;
Type 0 1;
Color 1 4;
Marker K102 K113;
Type 19;
Color 1;
Size 2.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.
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 "
# 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 "
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";
Connect;
Color 1;
Size 2;
Area;
Type 0 1;
Color 1 4;
Marker K102 K113;
Type 19;
Color 1;
Size 2.0;
Marker K115 K114;
Type 19;
Color 1;
Size 2.0;
Overlay.
Return
EndMacro