downscale_pop: Downscaling of population data

View source: R/downscale_pop.R

downscale_popR Documentation

Downscaling of population data

Description

Downscaling of population data

Usage

downscale_pop(
  targets,
  times = NULL,
  xmat,
  betas,
  xmat.coltypes = NULL,
  xmat.proj = NULL,
  xmat.dyn.fun = xmat.identity,
  options = downscale_control_pop()
)

Arguments

targets

A dataframe with columns times, pop.type (optional), and value (all targets >= 0)

times

A character vector of time steps for downscaling. The first time step must be present in targets. If NULL, times are derived from unique values in targets. Default is NULL.

xmat

A dataframe of explanatory variables with columns ns, ks and value. Defaults to NULL. xmat and betas have to be provided for each pop.type in targets.

betas

A dataframe of coefficients with columns ks, pop.type (optional), and value. Defaults to NULL. xmat and betas have to be provided for each pop.type in targets.

xmat.coltypes

A vector ks, with each element being either "static", "dynamic", or "projected". Determines how different columns in xmat are treated during the downscaling process.

xmat.proj

A dataframe with projections. Includes columns: times (character), ns (character), ks (character), and value (numeric). Required for each xmat.coltype specified as projected.

xmat.dyn.fun

A function providing updates for dynamic xmat columns. Takes as arguments res, curr.areas, priors, xmat.proj and must return a dataframe with ⁠ns x ks(dynamic)⁠ columns.

options

A list with solver options. Call downscale_control_pop for default options and for more detail.

Value

A list containing

  • out.res Dataframe with columns times, ns, pop.type & value (population allocation)

  • out.solver A list of the solver output

  • ds.inputs A list documenting all the downscale function inputs

Examples

dgp1 = sim_pop(1000)
res1 = downscale_pop(targets = dgp1$targets,xmat = dgp1$xmat,betas = dgp1$betas)

tkrisztin/downscalr documentation built on June 2, 2025, 1:16 a.m.