55import  scipy .stats  as  stats 
66from  batchglm .models .glm_nb  import  Model  as  NBModel 
77from  batchglm .models .glm_norm  import  Model  as  NormModel 
8+ from  batchglm .models .glm_poisson  import  Model  as  PoissonModel 
89
910import  diffxpy .api  as  de 
1011
@@ -29,6 +30,10 @@ def _prepate_data(
2930            rand_fn_loc  =  lambda  shape : np .random .uniform (500 , 1000 , shape )
3031            rand_fn_scale  =  lambda  shape : np .random .uniform (1 , 2 , shape )
3132            model  =  NormModel ()
33+         elif  self .noise_model  ==  "poisson" :
34+             rand_fn_loc  =  lambda  shape : np .random .uniform (2 , 10 , shape )
35+             rand_fn_scale  =  lambda  shape : np .random .uniform (1 , 2 , shape ) # not used b/c only loc param 
36+             model  =  PoissonModel ()
3237        else :
3338            raise  ValueError ("noise model %s not recognized"  %  self .noise_model )
3439
@@ -109,7 +114,7 @@ def test_null_distribution_ttest(self):
109114        logging .getLogger ("diffxpy" ).setLevel (logging .WARNING )
110115
111116        np .random .seed (1 )
112-         self .noise_model  =  None 
117+         self .noise_model  =  "norm" 
113118        self ._test_null_distribution_basic (test = "t-test" , lazy = False )
114119
115120    def  test_null_distribution_rank (self ):
@@ -118,9 +123,48 @@ def test_null_distribution_rank(self):
118123        logging .getLogger ("diffxpy" ).setLevel (logging .WARNING )
119124
120125        np .random .seed (1 )
121-         self .noise_model  =  None 
126+         self .noise_model  =  "norm" 
122127        self ._test_null_distribution_basic (test = "rank" , lazy = False )
123128
129+ class  TestPairwiseNullPoisson (unittest .TestCase , _TestPairwiseNull ):
130+ 
131+     def  test_null_distribution_ztest (self ):
132+         logging .getLogger ("tensorflow" ).setLevel (logging .ERROR )
133+         logging .getLogger ("batchglm" ).setLevel (logging .WARNING )
134+         logging .getLogger ("diffxpy" ).setLevel (logging .WARNING )
135+ 
136+         np .random .seed (1 )
137+         self .noise_model  =  "poisson" 
138+         self ._test_null_distribution_basic (test = "z-test" , lazy = False , quick_scale = False )
139+ 
140+     def  test_null_distribution_ztest_lazy (self ):
141+         logging .getLogger ("tensorflow" ).setLevel (logging .ERROR )
142+         logging .getLogger ("batchglm" ).setLevel (logging .WARNING )
143+         logging .getLogger ("diffxpy" ).setLevel (logging .WARNING )
144+ 
145+         np .random .seed (1 )
146+         self .noise_model  =  "poisson" 
147+         self ._test_null_distribution_basic (test = "z-test" , lazy = True , quick_scale = False )
148+ 
149+     def  test_null_distribution_wald (self ):
150+         logging .getLogger ("tensorflow" ).setLevel (logging .ERROR )
151+         logging .getLogger ("batchglm" ).setLevel (logging .WARNING )
152+         logging .getLogger ("diffxpy" ).setLevel (logging .WARNING )
153+ 
154+         np .random .seed (1 )
155+         self .noise_model  =  "poisson" 
156+         self ._test_null_distribution_basic (test = "wald" , lazy = False , quick_scale = False )
157+ 
158+     def  test_null_distribution_lrt (self ):
159+         logging .getLogger ("tensorflow" ).setLevel (logging .ERROR )
160+         logging .getLogger ("batchglm" ).setLevel (logging .WARNING )
161+         logging .getLogger ("diffxpy" ).setLevel (logging .WARNING )
162+ 
163+         np .random .seed (1 )
164+         self .noise_model  =  "poisson" 
165+         self ._test_null_distribution_basic (test = "lrt" , lazy = False , quick_scale = False )
166+ 
167+ 
124168
125169class  TestPairwiseNullNb (unittest .TestCase , _TestPairwiseNull ):
126170
0 commit comments