Skip to content

Conversation

@jeliason
Copy link
Owner

No description provided.

Implement Phase 1 of spatial covariate functionality allowing users to
include location-specific features (e.g., distance from boundary, tissue
regions, local density) in SHADE models.

Changes:
- Add covariates parameter to make_data() with validation
- Add covariate_list and quadrature_list parameters to prepare_spatial_model_data()
- Update metadata to track covariate column names and indices
- Add comprehensive tests for covariate functionality
- Include working example demonstrating covariate usage

Covariates are appended to the design matrix after dispersion features
and automatically receive hierarchical coefficients in the Stan model.
All changes are backward compatible.
Implements flexible API for extracting Spatial Interaction Curves (SICs)
at different hierarchical levels (image, patient, group) with credible bands:

- Core functions:
  * compute_sic_posterior() - Returns rvar posteriors for custom analysis
  * add_simultaneous_bands() - Family-wise credible bands
  * add_pointwise_bands() - Pointwise credible bands

- Convenience wrappers:
  * extract_group_sics() - Group-level extraction with bands
  * extract_patient_sics() - Patient-level extraction with bands
  * extract_image_sics() - Image-level extraction with bands

- Refactored plot_spatial_interaction_curves() to use new API
- Added comprehensive tests (49 tests) including coverage validation
- Added detailed example demonstrating all features

The API supports tidyverse-style pipelines using posterior::rvar for
natural uncertainty quantification workflows.
- Add test-examples-vignettes.R with tests for:
  - covariate_example.R execution
  - sic_extraction_example.R execution
  - Introduction vignette rendering

Bug fixes discovered during testing:
- Fix plot_spatial_interaction_curves() undefined variable errors
- Support CmdStanVB (variational inference) in SIC extraction
- Add focal_type and n_basis_functions to preprocessing metadata
- Fix SIC extraction to use stored focal_type instead of num_types
- Add namespace-qualified tidyr/dplyr calls in examples

Also removes vignette build artifacts that shouldn't be tracked.
@jeliason jeliason merged commit a59eb48 into main Nov 26, 2025
5 checks passed
@jeliason jeliason deleted the feature/spatial-covariates branch November 26, 2025 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants