getMobilityIndices: Calculates Mobility Indices at Two Points in Time

Description Usage Arguments Value Examples

View source: R/mobilityIndexFunctions.R

Description

Calculates mobility indices from two columns in dataset. Supports Prais-Bibby, Absolute Movement, Origin Specific, and Weighted Group Mobility indices and relative, mixed, and absolute types of rankings in the calculation these indices.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
getMobilityIndices(
  dat,
  col_x,
  col_y,
  type,
  indices = "all",
  num_ranks,
  exclude_value,
  bounds,
  rerank_exclude_value,
  strict = TRUE,
  intervals = FALSE,
  interval_pct = 0.95,
  bootstrap_iter = 100
)

Arguments

dat

a dataframe with an "id" column

col_x

a character string denoting the first column to be used in the index calculation

col_y

a character string denoting the second column to be used in the index calculation

type

a character string indicating the type of ranking; accepts 'relative', 'mixed', and 'absolute'

indices

a vector of character strings indicating which mobility indices are desired; currently support 'prais_bibby', 'average_movement', 'wgm', and 'origin_specific'. The default value is 'all'.

num_ranks

an integer specifying the number of ranks for a relative or mixed ranking

exclude_value

a single numeric value that is excluded in calculating the transition matrix; see the rerank_exclude_value parameter to specify how the exclude value is handled

bounds

a sequence of numeric bounds for defining absolute ranks

rerank_exclude_value

a character string indicating how the exclude value is handled when present; accepts 'as_new_rank', 'as_existing_rank', and 'exclude'

strict

logical. If TRUE, indices are calculated from the given values. If FALSE, indices are calculated by jittering the values to ensure uniqueness of bounds of ranks. Only used with relative and mixed types. The default value is TRUE.

intervals

logical. If TRUE, will calculate bootstrapped confidence intervals using the percentile method. The default value is FALSE.

interval_pct

a number between zero and one indicating the size of the bootstrapped intervals. The default value is 0.95.

bootstrap_iter

the number of bootstrap iterations used to estimate intervals. The default value is 100.

Value

Returns a named vector containing the desired index values

Examples

1
2
3
4
5
6
data(incomeMobility)
getMobilityIndices(dat = incomeMobility,
                   col_x = 't0',
                   col_y = 't2',
                   type = 'relative',
                   num_ranks = 5)

mobilityIndexR documentation built on Jan. 20, 2021, 5:09 p.m.