Spaces:
Running
Running
Zekun Wu
commited on
Commit
·
8e6aee2
1
Parent(s):
34a8b7c
update
Browse files- util/analysis.py +15 -10
util/analysis.py
CHANGED
@@ -304,22 +304,27 @@ def result_evaluation(test_results, test_type='multiple'):
|
|
304 |
# Statistical tests evaluation
|
305 |
for test_name, result in test_results.items():
|
306 |
if 'Test' in test_name and test_name != 'Tukey HSD Test': # Generalizing test evaluations
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
|
|
|
|
|
|
311 |
|
312 |
# Special case evaluations
|
313 |
if 'Wilcoxon Test Between Pairs' in test_results:
|
314 |
-
|
315 |
-
|
|
|
316 |
else:
|
317 |
-
|
318 |
-
evaluation['Wilcoxon Test Between Pairs'] = f"Significant rank difference between {variables[0]} and {variables[1]} (p = {p_value:.5f}), indicating bias." if p_value < 0.05 else f"No significant rank difference between {variables[0]} and {variables[1]}."
|
319 |
|
320 |
# ANOVA and Tukey HSD tests
|
321 |
if test_type == 'multiple':
|
322 |
-
|
323 |
-
evaluation['
|
|
|
324 |
|
325 |
return evaluation
|
|
|
|
304 |
# Statistical tests evaluation
|
305 |
for test_name, result in test_results.items():
|
306 |
if 'Test' in test_name and test_name != 'Tukey HSD Test': # Generalizing test evaluations
|
307 |
+
if isinstance(result, dict) and 'p-value' in result:
|
308 |
+
p_value = result['p-value']
|
309 |
+
significant = p_value < 0.05
|
310 |
+
test_label = test_name.replace('_', ' ').replace('Test Between', 'between')
|
311 |
+
evaluation[test_name] = f"Significant {test_label.lower()} observed (p = {p_value:.5f}), indicating potential biases." if significant else f"No significant {test_label.lower()}."
|
312 |
+
else:
|
313 |
+
evaluation[test_name] = "Test result format error or incomplete data."
|
314 |
|
315 |
# Special case evaluations
|
316 |
if 'Wilcoxon Test Between Pairs' in test_results:
|
317 |
+
wilcoxon_result = test_results['Wilcoxon Test Between Pairs']
|
318 |
+
if isinstance(wilcoxon_result, float):
|
319 |
+
evaluation['Wilcoxon Test Between Pairs'] = f"Significant rank difference between {variables[0]} and {variables[1]} (p = {wilcoxon_result:.5f}), indicating bias." if wilcoxon_result < 0.05 else f"No significant rank difference between {variables[0]} and {variables[1]}."
|
320 |
else:
|
321 |
+
evaluation['Wilcoxon Test Between Pairs'] = wilcoxon_result # Presuming it's an error message or non-numeric value
|
|
|
322 |
|
323 |
# ANOVA and Tukey HSD tests
|
324 |
if test_type == 'multiple':
|
325 |
+
anova_p = test_results['ANOVA Test'].get('p-value', 1) # Default to 1 if p-value is missing
|
326 |
+
evaluation['ANOVA Test'] = f"No significant differences among all groups (p = {anova_p:.5f}), no further post-hoc analysis required." if anova_p >= 0.05 else test_results['ANOVA Test']
|
327 |
+
evaluation['Tukey HSD Test'] = test_results.get('Tukey HSD Test', 'Tukey test not performed or data missing.')
|
328 |
|
329 |
return evaluation
|
330 |
+
|