incdist: An income distribution object

View source: R/incdist.R

incdistR Documentation

An income distribution object

Description

This function creates an object of class incdist that can be used to facilitate income distribution analysis.

Usage

incdist(x, ...)

Arguments

formula

a one-or two-sided formula that defines the resource variables of interest.

weights

sampling weights.

data

a data frame that holds the data.

subset

defines a subset of the data to be used.

eqsale

defines a transformation of each resource variable. Defaults to NULL, that is, no transformation.

group

a one-sided formula that defines the grouping structure.

part

a one-sided formula that defines breaks in the data, for which analyses are done separately.

idvar

a one-sided formula that auxiliary variables to be kept in the resulting object, for instance, variables needed for equivalence scale transformation or deflating the analysis variables.

na.rm

a logical indicating if only complete cases should be used.

func

a character vector giving which income distribution functionals to calculate.

Details

The incdist object can be summarized, and the summary can be printed and plotted (plotting is currently broken).

Value

An object of class incdist.

Author(s)

Markus Jantti markus.jantti@iki.fi

References

\insertRef

lambert1993incdist

Examples


## generate some data
## income components
n <- 1000
x1 <- runif(n)
x2 <- rexp(n)
a <- ifelse(a <- rpois(n, 1), a, 1)
c <- rpois(n, 2)
## sum to total income
y1 <- x1 + x2
## generate a grouping
g <- factor(rbinom(n, 1, .5), labels = letters[1:2])
## generate a partitioning variable
p <- factor(sample(c(1, 2, 3), n, replace = TRUE),
            labels = paste("t", 1:3, sep = ""))
## generate some weights
w <- rpois(n, 5)
## put it all into a data frame
test.d <- data.frame(x1, x2, y1, g, p, a, c, w)

summary(incdist(y1 ~ x1 +  x2, data=test.d, group = ~ g))
summary(incdist(y1 ~ x1 +  x2, data=test.d, part = ~ p))
id.0 <- incdist(y1 ~ x1 +  x2, data=test.d, part = ~ p, group = ~ g,
                idvar = ~ a + c,  weights = w)
id.0$eqscale <- list(formula = ~ (a + k*c)^d, coef=list(k=.8, d=.75),
             type="citro-michael")

print(summary(id.0, equivalise = FALSE), all = TRUE)
print(summary(id.0, equivalise = TRUE), all = TRUE) # the default
print(id.0)
## there is not such function: plot(id.0)

mjantti/incdist documentation built on Aug. 23, 2023, 5:33 p.m.