Create the Blending and Distilling Object
alembic.Rd
Create the Blending and Distilling Object
Arguments
- f_param
a function,
f(x)
which transforms the feature (e.g. age), and yields the parameter value. Alternatively, adata.frame
where the first column is the feature (x) and the second is the parameter (y); seexy.coords()
for details. If the latter, combined withpars_interp_opts
, and defaulting to spline interpolation.- f_dense
like
f_param
, either a density function (though it does not have to integrate to 1 like a pdf) or adata.frame
of values. If the latter, combined withdens_interp_opts
and defaulting to constant density from each x to the next.- model_partition
a numeric vector of cut points, which define the partitioning that will be used in the model
- output_partition
the partition of the underlying feature
- pars_interp_opts
a list, minimally with an element
fun
, corresponding to an interpolation function. Defaults tosplinefun()
"natural" interpolation- dens_interp_opts
ibid, but for density. Defaults to
approxfun()
"constant" interpolation
Value
a data.frame
which maps fractions of the original model partitions
to the desired partitions, according to underlying relative outcome rates and
densities
Examples
ifr_levin <- function(age_in_years) {
(10^(-3.27 + 0.0524 * age_in_years))/100
}
age_limits <- c(seq(0, 69, by = 5), 70, 80, 100)
age_pyramid <- data.frame(
from = 0:100, weight = ifelse(0:100 < 65, 1, .99^(0:100-64))
) # flat age distribution, then 1% annual deaths
ifr_alembic <- alembic(ifr_levin, age_pyramid, age_limits, 0:100)