@@ -479,17 +479,6 @@ def wald(
479
479
`training_strategy(estimator)`.
480
480
- list of keyword dicts containing method arguments: Will call Estimator.train() once with each dict of
481
481
method arguments.
482
-
483
- Example:
484
-
485
- .. code-block:: python
486
-
487
- [
488
- {"learning_rate": 0.5, },
489
- {"learning_rate": 0.05, },
490
- ]
491
-
492
- This will run training first with learning rate = 0.5 and then with learning rate = 0.05.
493
482
:param quick_scale: Depending on the optimizer, `scale` will be fitted faster and maybe less accurate.
494
483
495
484
Useful in scenarios where fitting the exact `scale` is not absolutely necessary.
@@ -731,7 +720,7 @@ def two_sample(
731
720
The exact unit_test are as follows (assuming the group labels
732
721
are saved in a column named "group"):
733
722
734
- - lrt(log-likelihood ratio test):
723
+ - " lrt" - (log-likelihood ratio test):
735
724
Requires the fitting of 2 generalized linear models (full and reduced).
736
725
The models are automatically assembled as follows, use the de.test.lrt()
737
726
function if you would like to perform a different test.
@@ -740,15 +729,15 @@ def two_sample(
740
729
* full model scale parameter: ~ 1 + group
741
730
* reduced model location parameter: ~ 1
742
731
* reduced model scale parameter: ~ 1 + group
743
- - Wald test:
732
+ - "wald" - Wald test:
744
733
Requires the fitting of 1 generalized linear models.
745
734
model location parameter: ~ 1 + group
746
735
model scale parameter: ~ 1 + group
747
736
Test the group coefficient of the location parameter model against 0.
748
- - t-test:
737
+ - "t-test" - Welch's t-test:
749
738
Doesn't require fitting of generalized linear models.
750
739
Welch's t-test between both observation groups.
751
- - wilcoxon :
740
+ - "rank" - Wilcoxon rank sum (Mann-Whitney U) test :
752
741
Doesn't require fitting of generalized linear models.
753
742
Wilcoxon rank sum (Mann-Whitney U) test between both observation groups.
754
743
@@ -769,33 +758,22 @@ def two_sample(
769
758
- 'wald': default
770
759
- 'lrt'
771
760
- 't-test'
772
- - 'wilcoxon '
761
+ - 'rank '
773
762
:param gene_names: optional list/array of gene names which will be used if `data` does not implicitly store these
774
763
:param sample_description: optional pandas.DataFrame containing sample annotations
764
+ :param size_factors: 1D array of transformed library size factors for each cell in the
765
+ same order as in data
775
766
:param noise_model: str, noise model to use in model-based unit_test. Possible options:
776
767
777
768
- 'nb': default
778
- :param size_factors: 1D array of transformed library size factors for each cell in the
779
- same order as in data
780
- :param batch_size: the batch size to use for the estimator
769
+ :param batch_size: The batch size to use for the estimator.
781
770
:param training_strategy: {str, function, list} training strategy to use. Can be:
782
771
783
772
- str: will use Estimator.TrainingStrategy[training_strategy] to train
784
773
- function: Can be used to implement custom training function will be called as
785
774
`training_strategy(estimator)`.
786
775
- list of keyword dicts containing method arguments: Will call Estimator.train() once with each dict of
787
776
method arguments.
788
-
789
- Example:
790
-
791
- .. code-block:: python
792
-
793
- [
794
- {"learning_rate": 0.5, },
795
- {"learning_rate": 0.05, },
796
- ]
797
-
798
- This will run training first with learning rate = 0.5 and then with learning rate = 0.05.
799
777
:param quick_scale: Depending on the optimizer, `scale` will be fitted faster and maybe less accurate.
800
778
801
779
Useful in scenarios where fitting the exact `scale` is not absolutely necessary.
@@ -804,8 +782,8 @@ def two_sample(
804
782
Should be "float32" for single precision or "float64" for double precision.
805
783
:param kwargs: [Debugging] Additional arguments will be passed to the _fit method.
806
784
"""
807
- if test in ['t-test' , 'wilcoxon ' ] and noise_model is not None :
808
- raise ValueError ('base.two_sample(): Do not specify `noise_model` if using test t-test or wilcoxon : ' +
785
+ if test in ['t-test' , 'rank ' ] and noise_model is not None :
786
+ raise ValueError ('base.two_sample(): Do not specify `noise_model` if using test t-test or rank_test : ' +
809
787
'The t-test is based on a gaussian noise model and wilcoxon is model free.' )
810
788
811
789
gene_names = parse_gene_names (data , gene_names )
@@ -849,9 +827,9 @@ def two_sample(
849
827
if noise_model is None :
850
828
raise ValueError ("Please specify noise_model" )
851
829
full_formula_loc = '~ 1 + grouping'
852
- full_formula_scale = '~ 1 + grouping '
830
+ full_formula_scale = '~ 1'
853
831
reduced_formula_loc = '~ 1'
854
- reduced_formula_scale = '~ 1 + grouping '
832
+ reduced_formula_scale = '~ 1'
855
833
de_test = lrt (
856
834
data = X ,
857
835
full_formula_loc = full_formula_loc ,
@@ -876,7 +854,7 @@ def two_sample(
876
854
grouping = grouping ,
877
855
dtype = dtype
878
856
)
879
- elif test .lower () == 'wilcoxon ' :
857
+ elif test .lower () == 'rank ' :
880
858
de_test = rank_test (
881
859
data = X ,
882
860
gene_names = gene_names ,
@@ -898,12 +876,12 @@ def pairwise(
898
876
gene_names : Union [np .ndarray , list ] = None ,
899
877
sample_description : pd .DataFrame = None ,
900
878
noise_model : str = None ,
901
- pval_correction : str = "global" ,
902
879
size_factors : np .ndarray = None ,
903
880
batch_size : int = None ,
904
881
training_strategy : Union [str , List [Dict [str , object ]], Callable ] = "AUTO" ,
905
882
quick_scale : bool = None ,
906
883
dtype = "float64" ,
884
+ pval_correction : str = "global" ,
907
885
keep_full_test_objs : bool = False ,
908
886
** kwargs
909
887
):
@@ -922,22 +900,22 @@ def pairwise(
922
900
on the subset of the data that only contains observations of a given
923
901
pair of groups:
924
902
925
- - lrt( log-likelihood ratio test) :
903
+ - " lrt" - log-likelihood ratio test:
926
904
Requires the fitting of 2 generalized linear models (full and reduced).
927
905
928
906
* full model location parameter: ~ 1 + group
929
907
* full model scale parameter: ~ 1 + group
930
908
* reduced model location parameter: ~ 1
931
909
* reduced model scale parameter: ~ 1 + group
932
- - Wald test:
910
+ - "wald" - Wald test:
933
911
Requires the fitting of 1 generalized linear models.
934
912
model location parameter: ~ 1 + group
935
913
model scale parameter: ~ 1 + group
936
914
Test the group coefficient of the location parameter model against 0.
937
- - t-test:
915
+ - "t-test" - Welch's t-test:
938
916
Doesn't require fitting of generalized linear models.
939
917
Welch's t-test between both observation groups.
940
- - wilcoxon :
918
+ - "rank" - Wilcoxon rank sum (Mann-Whitney U) test :
941
919
Doesn't require fitting of generalized linear models.
942
920
Wilcoxon rank sum (Mann-Whitney U) test between both observation groups.
943
921
@@ -959,7 +937,7 @@ def pairwise(
959
937
- 'wald'
960
938
- 'lrt'
961
939
- 't-test'
962
- - 'wilcoxon '
940
+ - 'rank '
963
941
:param lazy: bool, whether to enable lazy results evaluation.
964
942
This is only possible if test=="ztest" and yields an output object which computes
965
943
p-values etc. only upon request of certain pairs. This makes sense if the entire
@@ -968,41 +946,30 @@ def pairwise(
968
946
a certain subset of the pairwise comparisons is desired anyway.
969
947
:param gene_names: optional list/array of gene names which will be used if `data` does not implicitly store these
970
948
:param sample_description: optional pandas.DataFrame containing sample annotations
949
+ :param size_factors: 1D array of transformed library size factors for each cell in the
950
+ same order as in data
971
951
:param noise_model: str, noise model to use in model-based unit_test. Possible options:
972
952
973
953
- 'nb': default
974
- :param pval_correction: Choose between global and test-wise correction.
975
- Can be:
976
-
977
- - "global": correct all p-values in one operation
978
- - "by_test": correct the p-values of each test individually
979
- :param size_factors: 1D array of transformed library size factors for each cell in the
980
- same order as in data
981
- :param batch_size: the batch size to use for the estimator
954
+ :param batch_size: The batch size to use for the estimator.
982
955
:param training_strategy: {str, function, list} training strategy to use. Can be:
983
956
984
957
- str: will use Estimator.TrainingStrategy[training_strategy] to train
985
958
- function: Can be used to implement custom training function will be called as
986
959
`training_strategy(estimator)`.
987
960
- list of keyword dicts containing method arguments: Will call Estimator.train() once with each dict of
988
961
method arguments.
989
-
990
- Example:
991
-
992
- .. code-block:: python
993
-
994
- [
995
- {"learning_rate": 0.5, },
996
- {"learning_rate": 0.05, },
997
- ]
998
-
999
- This will run training first with learning rate = 0.5 and then with learning rate = 0.05.
1000
962
:param quick_scale: Depending on the optimizer, `scale` will be fitted faster and maybe less accurate.
1001
963
1002
964
Useful in scenarios where fitting the exact `scale` is not absolutely necessary.
1003
965
:param dtype: Allows specifying the precision which should be used to fit data.
1004
966
1005
967
Should be "float32" for single precision or "float64" for double precision.
968
+ :param pval_correction: Choose between global and test-wise correction.
969
+ Can be:
970
+
971
+ - "global": correct all p-values in one operation
972
+ - "by_test": correct the p-values of each test individually
1006
973
:param keep_full_test_objs: [Debugging] keep the individual test objects; currently valid for test != "z-test"
1007
974
:param kwargs: [Debugging] Additional arguments will be passed to the _fit method.
1008
975
"""
@@ -1115,12 +1082,12 @@ def versus_rest(
1115
1082
gene_names : Union [np .ndarray , list ] = None ,
1116
1083
sample_description : pd .DataFrame = None ,
1117
1084
noise_model : str = None ,
1118
- pval_correction : str = "global" ,
1119
1085
size_factors : np .ndarray = None ,
1120
1086
batch_size : int = None ,
1121
1087
training_strategy : Union [str , List [Dict [str , object ]], Callable ] = "AUTO" ,
1122
1088
quick_scale : bool = None ,
1123
1089
dtype = "float64" ,
1090
+ pval_correction : str = "global" ,
1124
1091
keep_full_test_objs : bool = False ,
1125
1092
** kwargs
1126
1093
):
@@ -1140,22 +1107,22 @@ def versus_rest(
1140
1107
is one group and the remaining groups are allocated to the second reference
1141
1108
group):
1142
1109
1143
- - lrt( log-likelihood ratio test):
1110
+ - " lrt" - log-likelihood ratio test):
1144
1111
Requires the fitting of 2 generalized linear models (full and reduced).
1145
1112
1146
1113
* full model location parameter: ~ 1 + group
1147
1114
* full model scale parameter: ~ 1 + group
1148
1115
* reduced model location parameter: ~ 1
1149
1116
* reduced model scale parameter: ~ 1 + group
1150
- - Wald test:
1117
+ - "wald" - Wald test:
1151
1118
Requires the fitting of 1 generalized linear models.
1152
1119
model location parameter: ~ 1 + group
1153
1120
model scale parameter: ~ 1 + group
1154
1121
Test the group coefficient of the location parameter model against 0.
1155
- - t-test:
1122
+ - "t-test" - Welch's t-test:
1156
1123
Doesn't require fitting of generalized linear models.
1157
1124
Welch's t-test between both observation groups.
1158
- - wilcoxon :
1125
+ - "rank" - Wilcoxon rank sum (Mann-Whitney U) test :
1159
1126
Doesn't require fitting of generalized linear models.
1160
1127
Wilcoxon rank sum (Mann-Whitney U) test between both observation groups.
1161
1128
@@ -1171,50 +1138,43 @@ def versus_rest(
1171
1138
which do not correpond to one-hot encoded discrete factors.
1172
1139
This makes sense for number of genes, time, pseudotime or space
1173
1140
for example.
1174
- :param test: str, statistical test to use. Possible options:
1141
+ :param test: str, statistical test to use. Possible options (see function description) :
1175
1142
1176
1143
- 'wald'
1177
1144
- 'lrt'
1178
1145
- 't-test'
1179
- - 'wilcoxon '
1146
+ - 'rank '
1180
1147
:param gene_names: optional list/array of gene names which will be used if `data` does not implicitly store these
1181
1148
:param sample_description: optional pandas.DataFrame containing sample annotations
1182
- :param noise_model: str, noise model to use in model-based unit_test. Possible options:
1183
-
1184
- - 'nb': default
1185
1149
:param pval_correction: Choose between global and test-wise correction.
1186
1150
Can be:
1187
1151
1188
1152
- "global": correct all p-values in one operation
1189
1153
- "by_test": correct the p-values of each test individually
1190
1154
:param size_factors: 1D array of transformed library size factors for each cell in the
1191
1155
same order as in data
1192
- :param batch_size: the batch size to use for the estimator
1156
+ :param noise_model: str, noise model to use in model-based unit_test. Possible options:
1157
+
1158
+ - 'nb': default
1159
+ :param batch_size: The batch size to use for the estimator.
1193
1160
:param training_strategy: {str, function, list} training strategy to use. Can be:
1194
1161
1195
1162
- str: will use Estimator.TrainingStrategy[training_strategy] to train
1196
1163
- function: Can be used to implement custom training function will be called as
1197
1164
`training_strategy(estimator)`.
1198
1165
- list of keyword dicts containing method arguments: Will call Estimator.train() once with each dict of
1199
1166
method arguments.
1200
-
1201
- Example:
1202
-
1203
- .. code-block:: python
1204
-
1205
- [
1206
- {"learning_rate": 0.5, },
1207
- {"learning_rate": 0.05, },
1208
- ]
1209
-
1210
- This will run training first with learning rate = 0.5 and then with learning rate = 0.05.
1211
1167
:param quick_scale: Depending on the optimizer, `scale` will be fitted faster and maybe less accurate.
1212
1168
1213
- Useful in scenarios where fitting the exact `scale` is not
1169
+ Useful in scenarios where fitting the exact `scale` is not absolutely necessary.
1214
1170
:param dtype: Allows specifying the precision which should be used to fit data.
1215
1171
1216
1172
Should be "float32" for single precision or "float64" for double precision.
1217
- :param keep_full_test_objs: [Debugging] keep the individual test objects; currently valid for test != "z-test"
1173
+ :param pval_correction: Choose between global and test-wise correction.
1174
+ Can be:
1175
+
1176
+ - "global": correct all p-values in one operation
1177
+ - "by_test": correct the p-values of each test individually
1218
1178
:param kwargs: [Debugging] Additional arguments will be passed to the _fit method.
1219
1179
"""
1220
1180
if len (kwargs ) != 0 :
@@ -1350,7 +1310,9 @@ def two_sample(
1350
1310
** kwargs
1351
1311
) -> _DifferentialExpressionTestMulti :
1352
1312
"""
1353
- See annotation of de.test.two_sample()
1313
+ Performs a two-sample test within each partition of a data set.
1314
+
1315
+ See also annotation of de.test.two_sample()
1354
1316
1355
1317
:param grouping: str
1356
1318
@@ -1366,7 +1328,7 @@ def two_sample(
1366
1328
- 'wald': default
1367
1329
- 'lrt'
1368
1330
- 't-test'
1369
- - 'wilcoxon '
1331
+ - 'rank '
1370
1332
:param size_factors: 1D array of transformed library size factors for each cell in the
1371
1333
same order as in data
1372
1334
:param noise_model: str, noise model to use in model-based unit_test. Possible options:
@@ -1410,7 +1372,9 @@ def t_test(
1410
1372
dtype = "float64"
1411
1373
):
1412
1374
"""
1413
- See annotation of de.test.t_test()
1375
+ Performs a Welch's t-test within each partition of a data set.
1376
+
1377
+ See also annotation of de.test.t_test()
1414
1378
1415
1379
:param grouping: str
1416
1380
@@ -1442,7 +1406,9 @@ def rank_test(
1442
1406
dtype = "float64"
1443
1407
):
1444
1408
"""
1445
- See annotation of de.test.wilcoxon()
1409
+ Performs a Wilcoxon rank sum test within each partition of a data set.
1410
+
1411
+ See also annotation of de.test.rank_test()
1446
1412
1447
1413
:param grouping: str, array
1448
1414
@@ -1481,7 +1447,9 @@ def lrt(
1481
1447
** kwargs
1482
1448
):
1483
1449
"""
1484
- See annotation of de.test.lrt()
1450
+ Performs a likelihood-ratio test within each partition of a data set.
1451
+
1452
+ See also annotation of de.test.lrt()
1485
1453
1486
1454
:param full_formula_loc: formula
1487
1455
Full model formula for location parameter model.
@@ -1577,8 +1545,9 @@ def wald(
1577
1545
** kwargs
1578
1546
):
1579
1547
"""
1580
- This function performs a wald test within each partition of a data set.
1581
- See annotation of de.test.wald()
1548
+ Performs a wald test within each partition of a data set.
1549
+
1550
+ See also annotation of de.test.wald()
1582
1551
1583
1552
:param factor_loc_totest: str, list of strings
1584
1553
List of factors of formula to test with Wald test.
0 commit comments