The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
(free 42) (DM42) Seven statistical distributions
06-30-2020, 08:11 PM (This post was last modified: 08-14-2020 09:13 PM by rawi.)
Post: #1
(free 42) (DM42) Seven statistical distributions
This program computes the probabilities and the cumulated probabilities resp. the distribution function and the cumulative distribution function of seven important statistical distributions:
- Binomial distribution
- Hypergeometric distribution
- Poisson distribution
- Standard normal distribution
- Student’s t distribution
- Chi-square distribution
- Fisher’s F distribution
Application:
After calling “STATD” the following is showed: "B H P N t C F"
Each letter stands for one distribution. To get to the distribution enter the position of the letter. If you want Hypergeometric distribution (=H) enter “2”, because H is in the second position, and press R/S.
Then the program asks for the parameters of the distribution. Enter them and press R/S. Then the probability resp. the value of the density function will be returned in Y-register whereas the cumulative probability f(X<=x) resp. the cumulative density function is returned in X-register.

Examples:

1st In Lotto 6 out of 49 are winning numbers. What is the probability that if you select 6 numbers randomly that you have at most 2 from the winning numbers (which means that you do not win at all):
XEQ “STATD” -> “B H P N t C F“ - We need Hypergeometric distribution, so we press
2 R/S -> “N” - The size of the universe is 49, so:
49 R/S -> “M” – The number of elements in the universe which are winning number is 6:
6 R/S -> “n” – The size of the sample is 6 ->
6 R/S -> “x” – The maximum number of winning numbers in sample we want to know the probability is 2 -> 2 R/S
Result in X-register: 0.9814 (prob(X<=2))
Result in Y-register: 0.1324 (prob(X=2))
So the probability not to win at all is greater than 98%.

2nd In a regression analysis with n=36 data points and k=3 independent variables the t-value for independent variable X1 is 2.234. Is this significant with a level of confidence of 95%?
XEQ “STATD” -> “B H P N t C F“ - We need Student’s t-distribution, so we press
5 R/S -> “df” – The regression has n-k-1 = 36-3-1 = 32 degrees of freedom
32 R/S -> “x”
2.234 R/S
Result in X-register: 0.9837
Result in Y-register: 0.0616
We need a symmetric interval. If on the right side there are 1.63% right of 2.234 there are 1.63% left of -2.234. Therefore this is significant with (100-2*1.63)% = 96.74% which is greater than 95%. So it is significant by 95%.

I hope this explains the application of the program.
Remarks:
1. The program uses the integral function of the calculator. It works with an accuracy of 1E-5. This can be changed by changing line 6 of the program.
2. The program need subroutines ndis, cdis, tdis, fdis.
Best
Raimund
Remark: August 14th: There can be a problem if X is not defined yet. So I added line 06 to avoid this.

Code:
00 { 418-Byte Prgm }
01▸LBL "STATD"
02 0
03 STO 01
04 STO 05
05 STO "LLIM"
06 STO "X"
07 1ᴇ-5
08 STO "ACC"
09 SF 01
10 "B H P N t C F"
11 PROMPT
12 XEQ IND ST X
13 RCL 06
14 RCL 05
15 RTN
16▸LBL 01
17 "p"
18 PROMPT
19 STO 00
20 STO- 01
21 "n"
22 PROMPT
23 STO 02
24 STO 04
25 "x"
26 PROMPT
27 STO 03
28 STO- 04
29 1
30 STO+ 01
31▸LBL 08
32 RCL 00
33 RCL 03
34 Y↑X
35 RCL 01
36 RCL 04
37 Y↑X
38 ×
39 RCL 02
40 RCL 03
41 COMB
42 ×
43 STO+ 05
44 FS?C 01
45 STO 06
46 1
47 STO- 03
48 STO+ 04
49 RCL 03
50 X<0?
51RTN
52 GTO 08
53▸LBL 02
54 "N"
55 PROMPT
56 STO 00
57 "M"
58 PROMPT
59 STO 01
60 "n"
61 PROMPT
62 STO 02
63 RCL 00
64 X<>Y
65 COMB
66 STO 04
67 "x"
68 PROMPT
69 STO 03
70▸LBL 09
71 RCL 01
72 RCL 03
73 COMB
74 RCL 04
75 ÷
76 RCL 00
77 RCL 01
78 -
79 RCL 02
80 RCL 03
81 -
82 COMB
83 ×
84 STO+ 05
85 FS?C 01
86 STO 06
87 1
88 STO- 03
89 RCL 03
90 X<0?
91 RTN
92 GTO 09
93▸LBL 03
94 "mue"
95 PROMPT
96 STO 00
97 "x"
98 PROMPT
99 STO 03
100▸LBL 10
101 RCL 00
102 +/-
103 E↑X
104 RCL 00
105 RCL 03
106 Y↑X
107 ×
108 RCL 03
109 N!
110 ÷
111 STO+ 05
112 FS?C 01
113 STO 06
114 1
115 STO- 03
116 RCL 03
117 X<0?
118 RTN
119 GTO 10
120▸LBL 04
121 CF 01
122 "z"
123 PROMPT
124 STO "ULIM"
125 2
126 PI
127 ×
128 SQRT
129 STO 00
130 XEQ "NDIS"
131 STO 06
132 PGMINT "NDIS"
133 INTEG "X"
134 0.5
135 +
136 STO 05
137 RTN
138▸LBL 05
139 CF 01
140 "df"
141 PROMPT
142 STO 02
143 "x"
144 PROMPT
145 STO "ULIM"
146 RCL 02
147 1
148 +
149 2
150 ÷
151 GAMMA
152 RCL 02
153 2
154 ÷
155 GAMMA
156 ÷
157 RCL 02
158 PI
159 ×
160 SQRT
161 ÷
162 STO 00
163 RCL "ULIM"
164 XEQ "TDIS"
165 STO 06
166 PGMINT "TDIS"
167 INTEG "X"
168 0.5
169 +
170 STO 05
171 RTN
172▸LBL 06
173 CF 01
174 "df"
175 PROMPT
176 STO 03
177 "x"
178 PROMPT
179 STO "ULIM"
180 XEQ "CDIS"
181 STO 06
182 PGMINT "CDIS"
183 INTEG "X"
184 STO 05
185 RTN
186▸LBL 07
187 CF 01
188 "df1"
189 PROMPT
190 STO 01
191 "df2"
192 PROMPT
193 STO 02
194 "x"
195 PROMPT
196 STO 03
197 STO "ULIM"
198 RCL 01
199 RCL 02
200 ÷
201 RCL 01
202 2
203 ÷
204 Y↑X
205 RCL 01
206 2
207 ÷
208 GAMMA
209 ÷
210 RCL 02
211 2
212 ÷
213 GAMMA
214 ÷
215 RCL 01
216 RCL 02
217 +
218 2
219 ÷
220 GAMMA
221 ×
222 STO 00
223 PGMINT "FDIS"
224 INTEG "X"
225 STO 05
226 RCL "ULIM"
227 XEQ "FDIS"
228 STO 06
229 RTN
230 END

00 { 23-Byte Prgm }
01▸LBL "NDIS"
02 MVAR "X"
03 RCL "X"
04 X↑2
05 -2
06 ÷
07 E↑X
08 RCL 00
09 ÷
10 RTN
11 END

00 { 47-Byte Prgm }
01▸LBL "CDIS"
02 MVAR "X"
03 RCL "X"
04 RCL 03
05 2
06 ÷
07 1
08 -
09 Y↑X
10 RCL "X"
11 +/-
12 2
13 ÷
14 E↑X
15 ×
16 2
17 RCL 03
18 2
19 ÷
20 Y↑X
21 ÷
22 RCL 03
23 2
24 ÷
25 GAMMA
26 ÷
27 RTN
28 END

00 { 32-Byte Prgm }
01▸LBL "TDIS"
02 MVAR "X"
03 RCL "X"
04 X↑2
05 RCL 02
06 ÷
07 1
08 +
09 RCL 02
10 1
11 +
12 2
13 ÷
14 +/-
15 Y↑X
16 RCL 00
17 ×
18 RTN
19 END

00 { 44-Byte Prgm }
01▸LBL "FDIS"
02 MVAR "X"
03 RCL "X"
04 RCL 01
05 ×
06 RCL 02
07 ÷
08 1
09 +
10 RCL 01
11 RCL 02
12 +
13 2
14 ÷
15 +/-
16 Y↑X
17 RCL "X"
18 RCL 01
19 2
20 ÷
21 1
22 -
23 Y↑X
24 ×
25 RCL 00
26 ×
27 RTN
28 END
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(free 42) (DM42) Seven statistical distributions - rawi - 06-30-2020 08:11 PM



User(s) browsing this thread: 2 Guest(s)