Post Reply 
(12C Platinum) Statistical significance calculator
04-13-2023, 10:06 AM (This post was last modified: 04-18-2023 01:40 PM by Tritonio.)
Post: #1
(12C Platinum) Statistical significance calculator
I translated a program that I had made for a few Casios (https://community.casiocalc.org/topic/81...-3650p-ii/) to the Platinum.

Register 1 is the total number of experiments.
Register 2 is the probability of an experiment randomly succeeding.
Register 3 is the number if experiments that succeeded.
Running it with the above will tell you the your confidence that the number of successful experiments is irregular and not explained just by luck. Putting a zero on register 3 will instead find how many experiments would need to succeed so that you could be at least 99% sure that it's not by luck.

Code:
001 RCL 3
002 X=0
003 GTO 040
004 0
005 STO 0
006 STO 4
007 RCL 1
008 n!
009 RCL 0
010 n!
011 ÷
012 RCL 1
013 RCL 0
014 -
015 n!
016 ÷
017 1
018 RCL 2
019 -
020 RCL 1
021 RCL 0
022 -
023 y^x
024 ×
025 RCL 2
026 RCL 0
027 y^x
028 ×
029 STO + 4
030 1
031 STO + 0
032 RCL 0
033 +
034 RCL 3
035 x<->y
036 x<=y
037 GTO 007
038 RCL 4
039 GTO 000
040 0
041 STO 4
042 RCL 1
043 n!
044 RCL 3
045 n!
046 ÷
047 RCL 1
048 RCL 3
049 -
050 n!
051 ÷
052 1
053 RCL 2
054 -
055 RCL 1
056 RCL 3
057 -
058 y^x
059 ×
060 RCL 2
061 RCL 3
062 y^x
063 ×
064 STO + 4
065 1
066 STO + 3
067 RCL 3
068 RCL 1
069 1
070 +
071 x<=y
072 GTO 080
073 0
074 .
075 9
076 9
077 RCL 4
078 x<=y
079 GTO 042
080 RCL 3
081 RCL 1
082 1
083 +
084 x<=y
085 GTO 088
086 RCL 3
087 GTO 000
088 1
089 CHG
090 STO 3

It's my first program on the Platinum so it can probably be improved a lot. I can think of two improvements that I didn't have time to do.

First, there is a big overlap between the case where register 3 was zero and the case where it wasn't. A good chunk of the code is the same so it could probably be reused and instead keep a flag that has the initial value of register 3 to decide what to do after we go out of the big shared code chunk. If you see the program in the Casio forum you'll notice that the long formula exists almost identical in two places. That that shared code I'm talking about.

Second, I'm calculating combinations using n!. That means that the program won't support more than 69 total experiments (register 1) as the n! will overflow for that number. But if you expand the combinations formula and actually calculate the fraction with loops you can go MUCH higher than that without overflowing. But that would need much more code.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(12C Platinum) Statistical significance calculator - Tritonio - 04-13-2023 10:06 AM



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