dimension_reduction {tidyindex}R Documentation

The dimension reduction module

Description

The module combines multiple variables into a new variable. The new variable can be a linear combination of the original variables, aggregate_linear(), or a geometric mean of the original variables, aggregate_geometry(), or created from an user formula input, aggregate_manual().

Usage

dimension_reduction(data, ...)

aggregate_linear(formula, weight)

aggregate_geometrical(formula)

aggregate_manual(formula)

Arguments

data

used in dimension_reduction(), an idx_tbl object, see [tidyindex::init()]

...

used in dimension_reduction(), a dimension reduction object of dim_red class, currently one of aggregate_linear(), aggregate_geometrical(), or aggregate_manual().

formula

the formula to evaluate

weight

used in aggregate_linear(), the column of the linear weights from the roles element in an index table object. See [tidyindex::add_paras()]

Value

an index table object

Examples

dt <- gggi |>
  dplyr::select(country, sex_ratio_at_birth:healthy_life_expectancy) |>
  init()

dt |>
  dimension_reduction(health = aggregate_manual(
    ~sex_ratio_at_birth * 0.693 + healthy_life_expectancy * 0.307))
dt |>
  add_paras(gggi_weights, by = variable) |>
  dimension_reduction(health = aggregate_linear(
    ~sex_ratio_at_birth:healthy_life_expectancy, weight = var_weight))
dt |>
  dimension_reduction(health = aggregate_geometrical(
    ~sex_ratio_at_birth:healthy_life_expectancy)
  )


[Package tidyindex version 0.1.0 Index]