@@ -26,6 +26,9 @@ def create_demo_dataset_delta(seed=9999, N=20):
2626 y = norm .rvs (loc = 3 , scale = 0.4 , size = N * 4 )
2727 y [N :2 * N ] = y [N :2 * N ]+ 1
2828 y [2 * N :3 * N ] = y [2 * N :3 * N ]- 0.5
29+ ind = np .random .binomial (1 , 0.5 , size = N * 4 )
30+ ind [N :2 * N ] = np .random .binomial (1 , 0.2 , size = N )
31+ ind [2 * N :3 * N ] = np .random .binomial (1 , 0.7 , size = N )
2932
3033 # Add drug column
3134 t1 = np .repeat ('Placebo' , N * 2 ).tolist ()
@@ -54,10 +57,11 @@ def create_demo_dataset_delta(seed=9999, N=20):
5457
5558 # Combine all columns into a DataFrame.
5659 df = pd .DataFrame ({'ID' : id_col ,
57- 'Rep' : rep ,
60+ 'Rep' : rep ,
5861 'Genotype' : genotype ,
59- 'Treatment' : treatment ,
60- 'Y' : y
62+ 'Treatment' : treatment ,
63+ 'Y' : y ,
64+ 'Cat' :ind
6165 })
6266 return df
6367
@@ -81,6 +85,34 @@ def create_demo_dataset_delta(seed=9999, N=20):
8185 experiment = "Genotype" ,
8286 paired = "sequential" , id_col = "ID" )
8387
88+ unpaired_prop = load (data = df , proportional = True ,
89+ # id_col="index", paired='baseline',
90+ x = ["Genotype" , "Genotype" ],
91+ y = "Cat" , delta2 = True ,
92+ experiment = "Treatment" ,)
93+
94+ unpaired_specified_prop = load (data = df , proportional = True ,
95+ # id_col="index", paired='baseline',
96+ x = ["Genotype" , "Genotype" ],
97+ y = "Cat" , delta2 = True ,
98+ experiment = "Treatment" ,
99+ experiment_label = ["Drug" , "Placebo" ],
100+ x1_level = ["M" , "W" ])
101+
102+ paired_prop = load (data = df , proportional = True ,
103+ id_col = "ID" , paired = 'baseline' ,
104+ x = ["Genotype" , "Genotype" ],
105+ y = "Cat" , delta2 = True ,
106+ experiment = "Treatment" ,)
107+
108+ paired_specified_prop = load (data = df , proportional = True ,
109+ id_col = "ID" , paired = 'baseline' ,
110+ x = ["Genotype" , "Genotype" ],
111+ y = "Cat" , delta2 = True ,
112+ experiment = "Treatment" ,
113+ experiment_label = ["Drug" , "Placebo" ],
114+ x1_level = ["M" , "W" ])
115+
84116
85117@pytest .mark .mpl_image_compare (tolerance = 8 )
86118def test_47_cummings_unpaired_delta_delta_meandiff ():
@@ -164,4 +196,20 @@ def test_72_sequential_delta_g():
164196
165197@pytest .mark .mpl_image_compare (tolerance = 8 )
166198def test_73_baseline_delta_g ():
167- return baseline .mean_diff .plot ();
199+ return baseline .mean_diff .plot ();
200+
201+ @pytest .mark .mpl_image_compare (tolerance = 8 )
202+ def test_74_unpaired_prop_delta2 ():
203+ return unpaired_prop .mean_diff .plot ()
204+
205+ @pytest .mark .mpl_image_compare (tolerance = 8 )
206+ def test_75_unpaired_specified_prop_delta2 ():
207+ return unpaired_specified_prop .mean_diff .plot ()
208+
209+ @pytest .mark .mpl_image_compare (tolerance = 8 )
210+ def test_76_paired_prop_delta2 ():
211+ return paired_prop .mean_diff .plot ()
212+
213+ @pytest .mark .mpl_image_compare (tolerance = 8 )
214+ def test_77_paired_specified_prop_delta2 ():
215+ return paired_specified_prop .mean_diff .plot ()
0 commit comments