dataProcessing: Data Processing

Description Usage Arguments Details Value Author(s) References Examples

View source: R/dataProcessing.R

Description

Convert raw data to frequency distribution framework and returns cumulative sums.

Usage

1
2
3
4
5

Arguments

units

Numeric vector of length n or matrix of dimension c(n, s) containing s sources referred to n statistical units

groups

Vector of length n of group membership. If empty only one group is considered, otherwise the number of groups g is defined by the number of distinct values or levels in this vector.

weights

Vector of lweights of length n. If empty uniform weights are considered.

Details

dataProcessing convert raw data in the frequency distribution framework with r distinct values of Y. In this way repeated values are removed as well as ordering issues. Moreover cumulative frequencies and cumulative sources values are evaluated in order to prepare data for inequality decompositions.

Value

yh

Vector of length r of distinct values of Y.

Phl

Matrix of absolute cumulative frequencies of dimension c(r, g).

Qhlk

Array of cumulative sum of sources of dimension c(r, g, s).

Author(s)

Alberto Arcagni, Igor Valli

References

Zenga M.M. (2007). Inequality curve and inequality index based on the ratios between lower and upper means. Statistica and Applicazioni, V(1), 3-27

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
G <- c(1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 3, 3) # vector denoting group membership
X1 <- c(0, 0, 0, 500, 700, 300, 750, 1000, 500, 500, 500, 1000) # vector of the first source
X2 <- c(0, 0, 0, 500, 300, 700, 750, 500, 700, 700, 1000,600) # vector of the second source
data <- data.frame(G, X1, X2) # no sample weights are considered

x <- dataProcessing(
  units = data[, c('X1', 'X2')],
  groups = data[, 'G'],
)
x

ineqJD documentation built on Sept. 20, 2019, 9:06 a.m.