Skip to content

Commit 4e27cc7

Browse files
committed
Update README with SIC extraction and credible band workflow
1 parent 1020ff6 commit 4e27cc7

1 file changed

Lines changed: 22 additions & 12 deletions

File tree

README.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,26 +97,36 @@ fit <- run_SHADE_model(
9797
threads = 2
9898
)
9999

100-
# Extract and summarize posterior estimates
101-
rvars <- as_draws_rvars(fit$draws())
102-
summary <- summarise_draws(rvars$beta_global)
103-
print(summary)
104-
105-
# Plot Spatial Interaction Curves (SICs)
106-
plot_spatial_interaction_curves(fit, prep, distance_range = c(0, 100))
100+
# Extract group-level SICs with simultaneous 95% credible bands
101+
group_sics <- extract_group_sics(fit, prep)
102+
103+
# Extract patient-level SICs
104+
patient_sics <- extract_patient_sics(fit, prep)
105+
106+
# Plot group-level SICs
107+
ggplot(group_sics, aes(x = distance, y = sic_mean, color = level_name)) +
108+
geom_ribbon(aes(ymin = sic_lower, ymax = sic_upper, fill = level_name), alpha = 0.2) +
109+
geom_line() +
110+
geom_hline(yintercept = 0, linetype = "dashed") +
111+
facet_wrap(~source) +
112+
theme_minimal() +
113+
labs(x = "Distance (µm)", y = "SIC (log-intensity)")
107114
```
108115

116+
For more fine-grained control, `compute_sic_posterior()` returns raw posterior `rvar` objects that can be passed to `add_simultaneous_bands()` or `add_pointwise_bands()`.
117+
109118
For a complete end-to-end example, see the file `vignettes/Introduction.qmd`.
110119

111120
## Package Overview
112121

113122
SHADE includes tools for:
114123

115-
- Preparing spatial point pattern data for hierarchical analysis
116-
- Defining flexible spatial interaction features via basis functions
117-
- Fitting multilevel spatial point process models using Stan
118-
- Summarizing posterior distributions of interaction curves
119-
- Comparing results across images, patients, and groups
124+
- **Data preparation:** Convert spatial point pattern data into hierarchical model inputs (`prepare_spatial_model_data()`)
125+
- **Simulation:** Generate synthetic spatial data with known directional interactions for validation (`simulate_spatial_data()`)
126+
- **Model fitting:** Fit multilevel spatial point process models via Stan, with MCMC or variational inference (`run_SHADE_model()`)
127+
- **SIC extraction:** Extract Spatial Interaction Curves at the group, patient, or image level (`extract_group_sics()`, `extract_patient_sics()`, `extract_image_sics()`)
128+
- **Uncertainty quantification:** Compute simultaneous or pointwise credible bands for SICs (`add_simultaneous_bands()`, `add_pointwise_bands()`)
129+
- **Prediction:** Generate spatial predictions from fitted models (`run_SHADE_gq()`)
120130

121131
## Citation and References
122132

0 commit comments

Comments
 (0)