standardise_to | R Documentation |
Standardised outputs are outputs from models with covariates, that are defined by marginalising (averaging) over covariate values in a given population, rather than being conditional on a given covariate value.
standardise_to(newdata, nstd = 1, random = FALSE)
standardize_to(newdata, nstd = 1, random = FALSE)
newdata |
Data frame describing a population. |
nstd |
Number of draws from the population distribution used
per MCMC sample from the parameters when |
random |
By default this is A quicker alternative is to sample a random row of the standard
population for each MCMC iteration. The standardised sample from
the posterior then has size |
These are produced by generating a Monte Carlo sample from
the joint distribution of parameters \theta
and covariate
values X
, p(X,\theta) = p(\theta|X)p(X)
, where
p(X)
is defined by the empirical distribution of covariates
in the standard population.
Hence applying a vectorised output function g()
(such as the
RMST or survival probability) to this sample produces a sample from
the posterior of \int g(\theta|X) dX
: the average RMST (say)
for a heterogeneous population.
See the Examples vignette for some examples and notes on computation.
A copy of newdata
, but with attributes added to
indicate that this should be used as a standard population. When
this newdata
is passed to survextrap
's output
functions, the outputs will then be presented as an average over
the empirical distribution of covariate values described by
newdata
, rather than as one output per row of
newdata
(distinct covariate values).
rxph_mod <- survextrap(Surv(years, status) ~ rx, data=colons, fit_method="opt")
ref_pop <- data.frame(rx = c("Obs","Lev+5FU"))
# covariate-specific outputs
survival(rxph_mod, t = c(5,10), newdata = ref_pop)
# standardised outputs
survival(rxph_mod, t = c(5,10), newdata = standardise_to(ref_pop))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.