chjackson / survextrap

Survival Extrapolation With a Flexible Parametric Model and External Data
https://chjackson.github.io/survextrap/
GNU General Public License v3.0
8 stars 3 forks source link

Standardised / marginalised outputs #10

Closed chjackson closed 10 months ago

chjackson commented 11 months ago

Currently all predictions from survextrap models are conditional on specific covariate values, as supplied in newdata. That is, a prediction $g(\theta,X)$ is done for fixed $X$.

It would be good to have an option to instead return outputs that are standardised over some or all covariates $X$. Specifically the integral of $g(\theta,X)$ with respect to a distribution of $X$ supplied by the user. This would generally be the empirical distribution of the covariate in the data used to fit the model.

Integrating over the empirical distribution of $X$, as well as over the posterior of $\theta$, may be computationally intensive. Particularly if any of the covariates are continuous, hence taking distinct values at each data point. So any suggestions are welcome for how to do this efficiently. I'm wondering if this computational problem has been investigated before, e.g. in causal inference contexts?

chjackson commented 10 months ago

Implemented in https://github.com/chjackson/survextrap/commit/7e0a4f287d8ff858766b9e883756dd9d130b4442