GMacro
tArea # For Release 14 - low density version of NormArea3
# Based on NormArea written by Jon Cryer: Jon-Cryer@uiowa.edu
#Note Graphic display of t 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 1.
#let C100(2) = 0
#In this version, input data is in C6 - degrees of freedom, zero, 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 k103 = 0
name k120 'median'
let k120 = 0
print k103, k120
Erase C100-C116 K100-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;
T K100. #Lower Limit
InvCDF .9999 k118;
T K100. #Upper Limit
Let K119 = K100 - 2
let K119 = K100/k119
Let K119 = SQRT(K119) #Standard Deviation
Let K105 = .01*K119
Let K101 = K119
Set C101
K117:K118/K105
End
PDF C101 C102;
t k100.
Set C103
K117:K102/K105
End
#Let K114 = N(C103)
#Let C103(K114) = K102
PDF C103 C104;
T K100.
CDF K102 C106; # Get area to report
T K100.
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 and stdev labeling
Let C108 = K100
Text C108 C108
Let K103 = C108 # df as text
Let C109 = K101
Text C109 C109
Let K104 = C109 # Stdev as text
Let K105 = "t Curve with "
Let K106 = " Degrees of Freedom 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 "t 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;
t K100. #Lower Limit
InvCDF .9999 k118;
t K100. #Upper Limit
Let K119 = K100 - 2
let K119 = K100/k119
Let K119 = SQRT(K119) #Standard Deviation
Let K105 = .01*K119
Let K101 = K119
Set C101
K117:K118/K105
End
PDF C101 C102;
t K100.
Set C103
K102:K118/K105
End
#Let K114 = N(C103)
#Let C103(K114) = K104
PDF C103 C104;
t K100.
CDF K102 C106; # Get area to report
t K100.
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 = "t Curve with "
Let K106 = " Degrees of Freedom 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 "t 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;
t K100. #Lower Limit
InvCDF .9999 k118;
t K100. #Upper Limit
Let K119 = K100 - 2
let K119 = K100/k119
Let K119 = SQRT(K119) #Standard Deviation
Let K105 = .01*K119
Let K101 = 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 t curve
t K100.
Set C103
K102:K115/K105
End
#Let K114 = N(C103)
#Let C103(K114) = K115
PDF C103 C104;
t K100.
CDF K102 C106; # Get area to report
t K100.
CDF K115 C110;
t K100.
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 degrees of freedom and stdev for labeling
Let C108 = K100
Text C108 C108
Let K103 = C108 # df as text
Let C109 = K119
Text C109 C109
Let K104 = C109 # Stdev as text
Let K105 = "t Curve with "
Let K106 = " Degrees of Freedom 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 "t 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