September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -1,17 +1,16 @@
|
|||
sub stats ( @test, @all ) {
|
||||
(([+] @test) / +@test ) - ([+] flat @all, (@test X* -1)) / (@all - @test)
|
||||
([+] @test / +@test) - ([+] flat @all, (@test X* -1)) / @all - @test
|
||||
}
|
||||
|
||||
|
||||
my int @treated = <85 88 75 66 25 29 83 39 97>;
|
||||
my int @control = <68 41 10 49 16 65 32 92 28 98>;
|
||||
my int @all = flat @treated, @control;
|
||||
|
||||
my $base = stats( @treated, @all );
|
||||
|
||||
my @trials = 0, 0, 0;
|
||||
my atomicint @trials[3] = 0, 0, 0;
|
||||
|
||||
@trials[ 1 + ( stats( $_, @all ) <=> $base ) ]++ for @all.combinations(+@treated);
|
||||
@all.combinations(+@treated).race.map: { @trials[ 1 + ( stats( $_, @all ) <=> $base ) ]⚛++ }
|
||||
|
||||
say 'Counts: <, =, > ', @trials;
|
||||
say 'Less than : %', 100 * @trials[0] / [+] @trials;
|
||||
|
|
|
|||
|
|
@ -3,30 +3,31 @@
|
|||
/* │ │ */
|
||||
/* │ └─────control population. */
|
||||
/* └────────treatment population. */
|
||||
n=9
|
||||
n= 9 /*define the number of the control pop.*/
|
||||
data= 85 88 75 66 25 29 83 39 97 68 41 10 49 16 65 32 92 28 98
|
||||
w=words(data); m=w-n
|
||||
say 'w=' w
|
||||
say 'volunteer population given treatment:' right(n, length(w) )
|
||||
say ' control population given a placebo:' right(m, length(w) )
|
||||
w= words(data); m= w - n /*w: volunteers + control population*/
|
||||
L= length(w)
|
||||
say '# of volunteers & control population: ' w
|
||||
say 'volunteer population given treatment: ' right(n, L)
|
||||
say ' control population given a placebo: ' right(m, L)
|
||||
say
|
||||
say 'treatment population efficacy % (percentages):' subword(data, 1, n)
|
||||
say ' control population placebo % (percentages):' subword(data, n+1 )
|
||||
say 'treatment population efficacy % (percentages): ' subword(data, 1, n)
|
||||
say ' control population placebo % (percentages): ' subword(data, n+1 )
|
||||
say
|
||||
do v= 0 for w ; #.v=word(data, v+1) ; end
|
||||
treat=0; do i= 0 to n-1 ; treat=treat + #.i ; end
|
||||
tot=1; do j= w to m+1 by -1 ; tot=tot * j ; end
|
||||
do k=w%2 to 1 by -1 ; tot=tot / k ; end
|
||||
do v= 0 for w ; #.v= word(data, v+1) ; end
|
||||
treat= 0; do i= 0 to n-1 ; treat= treat + #.i ; end
|
||||
tot= 1; do j= w to m+1 by -1 ; tot= tot * j ; end
|
||||
do k=w%2 to 1 by -1 ; tot= tot / k ; end
|
||||
|
||||
GT=picker(n+m, n, 0) /*compute the GT value from PICKER func*/
|
||||
LE=tot - GT /* " " LE " via subtraction.*/
|
||||
GT= picker(n+m, n, 0) /*compute the GT value from PICKER func*/
|
||||
LE= tot - GT /* " " LE " via subtraction.*/
|
||||
say "<= " format(100 * LE / tot, ,3)'%' LE /*display number with 3 decimal places.*/
|
||||
say " > " format(100 * GT / tot, ,3)'%' GT /* " " " " " " */
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
picker: procedure expose #. treat; parse arg it,rest,eff /*get args.*/
|
||||
if rest==0 then return eff > treat /*Zero ? */
|
||||
if it>rest then q=picker(it-1, rest, eff) /*recurse. */
|
||||
else q=0
|
||||
itP=it - 1 /*temp var.*/
|
||||
return picker(itP, rest - 1, eff+#.itP) + q /*recurse. */
|
||||
picker: procedure expose #. treat; parse arg it,rest,eff /*get the arguments.*/
|
||||
if rest==0 then return eff > treat /*is REST = to zero?*/
|
||||
if it>rest then q= picker(it-1, rest, eff) /*maybe recurse. */
|
||||
else q= 0
|
||||
itP= it - 1 /*set temporary var.*/
|
||||
return picker(itP, rest - 1, eff + #.itP) + q /*recurse. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue