Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
38
Task/Permutation-test/BBC-BASIC/permutation-test.basic
Normal file
38
Task/Permutation-test/BBC-BASIC/permutation-test.basic
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
ntreated% = 9
|
||||
nplacebo% = 10
|
||||
DIM results%(ntreated% + nplacebo% - 1)
|
||||
results%() = 85, 88, 75, 66, 25, 29, 83, 39, 97, \ REM treated group
|
||||
\ 68, 41, 10, 49, 16, 65, 32, 92, 28, 98 : REM placebo group
|
||||
|
||||
greater% = 0
|
||||
FOR comb% = 0 TO 2^(ntreated%+nplacebo%)-1
|
||||
IF FNnbits(comb%) = ntreated% THEN
|
||||
tsum% = 0 : psum% = 0
|
||||
FOR b% = 0 TO ntreated%+nplacebo%-1
|
||||
IF comb% AND 2^b% THEN
|
||||
tsum% += results%(b%)
|
||||
ELSE
|
||||
psum% += results%(b%)
|
||||
ENDIF
|
||||
NEXT
|
||||
meandiff = tsum%/ntreated% - psum%/nplacebo%
|
||||
IF comb% = 2^ntreated% - 1 THEN
|
||||
actual = meandiff
|
||||
ELSE
|
||||
greater% -= meandiff > actual
|
||||
groups% += 1
|
||||
ENDIF
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
percent = 100 * greater%/groups%
|
||||
PRINT "Percentage groupings <= actual experiment: "; 100 - percent
|
||||
PRINT "Percentage groupings > actual experiment: "; percent
|
||||
END
|
||||
|
||||
DEF FNnbits(N%)
|
||||
N% -= N% >>> 1 AND &55555555
|
||||
N% = (N% AND &33333333) + (N% >>> 2 AND &33333333)
|
||||
N% = (N% + (N% >>> 4)) AND &0F0F0F0F
|
||||
N% += N% >>> 8 : N% += N% >>> 16
|
||||
= N% AND &7F
|
||||
Loading…
Add table
Add a link
Reference in a new issue