GMacro
FArea # For Release 14 - low density version of NormArea3
# Based on NormArea written by Jon Cryer: Jon-Cryer@uiowa.edu
#Note Graphic display of F 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-K120)
#Note
#Note Enter the degrees of freedom.
#Set c100;
#file 'terminal';
#NObs 2.
#In this version, input data is in C6 - numerator degrees of freedom,
# denominator degrees of freedom, 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
Name k103 'mode'
let K120 = K101 + 1
Let K120 = K120*K100
Let K103 = K100 - 1
Let K103 = K103*K101/K120
Let K120 = 0.
print k103
Name k119 'std dev'
Print k119
Erase C100-C116 K100-K120
EndMacro
GMacro # Compute the variance
FVariance
Let K119 = K101 - 4
Let K120 = K101 - 2
Let K120 = K120 * K120
Let K119 = K101 - 4
Let K120 = K100 * K120 * K119
Let K119 = K100 + K101 - 2
Let K119 = K101 * K101 * K119
Let K119 = 2 * K119/K120
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)
InvCDF .0001 k117;
F K100 K101. #Lower Limit
InvCDF .9999 k118;
F K100 K101. #Upper Limit
Call FVariance
Let K119 = SQRT(K119) #Standard Deviation
Let K105 = .01*K119
Set C101
K117:K118/K105
End
PDF C101 C102;
F K100 K101.
Set C103
K117:K102/K105
End
#Let K114 = N(C103)
#Let C103(K114) = K102
PDF C103 C104;
F K100 K101.
CDF K102 C106; # Get area to report
F 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 DF labeling
Let C108 = K100
Text C108 C108
Let K103 = C108 # DF1 as text
Let C109 = K101
Text C109 C109
Let K104 = C109 # DF2 as text
Let K105 = "F Curve with Numerator DF of "
Let K106 = " Denominator DF of "
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 "F 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)
InvCDF .0001 k117;
F K100 K101. #Lower Limit
InvCDF .9999 k118;
F K100 K101. #Upper Limit
Call FVariance
Let K119 = SQRT(K119) #Standard Deviation
Let K105 = .01*K119
Set C101
K117:K118/K105
End
PDF C101 C102;
F K100 K101.
Set C103
K102:K118/K105
End
#Let K114 = N(C103)
#Let C103(K114) = K104
PDF C103 C104;
F K100 K101.
CDF K102 C106; # Get area to report
F 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 DF labeling
Let C108 = K100
Text C108 C108
Let K103 = C108 # DF1 as text
Let C109 = K101
Text C109 C109
Let K104 = C109 # DF2 as text
Let K105 = "F Curve with numerator DF of "
Let K106 = " and Denominator DF of "
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 "F 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)
InvCDF .0001 k117;
F K100 K101. #Lower Limit
InvCDF .9999 k118;
F K100 K101. #Upper Limit
Call FVariance
Let K119 = SQRT(K119) #Standard Deviation
Let K105 = .01*K119
#Let K103 = K100-4*K101
#let K104 = K100+4*K101
#Let K105 = .01*K101
Set C101
K117:K118/K105
End
PDF C101 C102; # Get values for full F curve
F K100 K101.
Set C103
K102:K115/K105
End
#Let K114 = N(C103)
#Let C103(K114) = K115
PDF C103 C104;
F K100 K101.
CDF K102 C106; # Get area to report
F K100 K101.
CDF K115 C110;
F 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 DF for labeling
Let C108 = K100
Text C108 C108
Let K103 = C108 # DF1 as text
Let C109 = K119
Text C109 C109
Let K104 = C109 # DF2 as text
Let K105 = "F Curve with numerator DF of "
Let K106 = " Denominator DF of "
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 "F 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