diff --git a/docs/commands/analyze.md b/docs/commands/analyze.md index 13b93b5..da482a0 100644 --- a/docs/commands/analyze.md +++ b/docs/commands/analyze.md @@ -61,7 +61,7 @@ The `analyze` command will generate a JSON file (default name: `analysis.json`) ```json { - "baseline_stats": { + "baseline": { "degrees_of_freedom": int, "average_temp": float, "std_dev_temp": float, @@ -69,12 +69,12 @@ The `analyze` command will generate a JSON file (default name: `analysis.json`) "min_temp": float, "residual_sum_squares": float }, - "residual_stats": { + "residual": { "max_residual": float, "residual_lower_bound": float, "residual_upper_bound": float }, - "duration_stats": { + "duration": { "total_duration_hours": float, "fever_hours": int, "hypothermia_hours": int diff --git a/tests/test_stats.py b/tests/test_stats.py index c2bf853..7a80acd 100644 --- a/tests/test_stats.py +++ b/tests/test_stats.py @@ -138,12 +138,12 @@ def test_get_all_stats(example_forecast_df, baseline_hours): pred_column="y_hat", residual_column="residual", ) - assert results["baseline_stats"]["degrees_of_freedom"] == 2721 - assert np.allclose(results["baseline_stats"]["average_temp"], 37.89085) - assert np.allclose(results["baseline_stats"]["std_dev_temp"], 0.70588941) - assert np.allclose(results["baseline_stats"]["residual_sum_squares"], 1911.0984) - assert np.allclose(results["residual_stats"]["max_residual"], 2.70556) - assert np.allclose(results["residual_stats"]["residual_upper_bound"], 0.264615542) - assert np.allclose(results["duration_stats"]["total_duration_hours"], 693.210555) - assert results["duration_stats"]["fever_hours"] == 261 - assert results["duration_stats"]["hypothermia_hours"] == 157 + assert results["baseline"]["degrees_of_freedom"] == 2721 + assert np.allclose(results["baseline"]["average_temp"], 37.89085) + assert np.allclose(results["baseline"]["std_dev_temp"], 0.70588941) + assert np.allclose(results["baseline"]["residual_sum_squares"], 1911.0984) + assert np.allclose(results["residual"]["max_residual"], 2.70556) + assert np.allclose(results["residual"]["residual_upper_bound"], 0.264615542) + assert np.allclose(results["duration"]["total_duration_hours"], 693.210555) + assert results["duration"]["fever_hours"] == 261 + assert results["duration"]["hypothermia_hours"] == 157 diff --git a/vaxstats/analysis/forecast.py b/vaxstats/analysis/forecast.py index 8e962e2..8123108 100644 --- a/vaxstats/analysis/forecast.py +++ b/vaxstats/analysis/forecast.py @@ -115,9 +115,9 @@ def run_analysis( # Combine all statistics into a single dictionary stats_dict = { - "baseline_stats": baseline_stats, - "residual_stats": residual_stats, - "duration_stats": duration_stats, + "baseline": baseline_stats, + "residual": residual_stats, + "duration": duration_stats, } return stats_dict