estimators: Presents Point, MSE and CV Estimates

View source: R/estimators.emdi.R

estimatorsR Documentation

Presents Point, MSE and CV Estimates

Description

Function estimators is a generic function used to present point and mean squared error (MSE) estimates and calculated coefficients of variation (CV).

Method estimators.emdi presents point and MSE estimates for regional disaggregated indicators. Coefficients of variation are calculated using these estimators. This method enables to select for which indicators the estimates shall be returned. The returned object is suitable for printing with the print.estimators.emdi method.

Usage

estimators(object, indicator, MSE, CV, ...)

## S3 method for class 'emdi'
estimators(object, indicator = "all", MSE = FALSE, CV = FALSE, ...)

Arguments

object

an object of type "emdi", representing point and, if chosen, MSE estimates.

indicator

optional character vector that selects which indicators shall be returned: (i) all calculated indicators ("all"); (ii) each indicator name: "Mean", "Quantile_10", "Quantile_25", "Median", "Quantile_75", "Quantile_90", "Head_Count", "Poverty_Gap", "Gini", "Quintile_Share" or the function name/s of "custom_indicator/s"; (iii) groups of indicators: "Quantiles", "Poverty", "Inequality" or "Custom". If two of these groups are selected, only the first one is returned. Note, additional custom indicators can be defined as argument for model-based approaches (see also ebp) and do not appear in groups of indicators even though these might belong to one of the groups. If the model argument is of type "fh", indicator can be set to "all", "Direct", FH", or "FH_Bench" (if emdi object is overwritten by function benchmark). Defaults to "all".

MSE

optional logical. If TRUE, MSE estimates for selected indicators per domain are added to the data frame of point estimates. Defaults to FALSE.

CV

optional logical. If TRUE, coefficients of variation for selected indicators per domain are added to the data frame of point estimates. Defaults to FALSE.

...

other parameters that can be passed to function estimators.

Details

Objects of class "estimators.emdi" have methods for following generic functions: head and tail (for default documentation, see head), as.matrix (for default documentation, see matrix), as.data.frame (for default documentation, see as.data.frame), subset (for default documentation, see subset).

Value

The return of estimators depends on the class of its argument. The documentation of particular methods gives detailed information about the return of that method.

The return of estimators.emdi is an object of type "estimators.emdi" with point and/or MSE estimates and/or calculated CV's per domain obtained from emdiObject$ind and, if chosen, emdiObject$MSE. These objects contain two elements, one data frame ind and a character naming the indicator or indicator group ind_name.

See Also

emdiObject, direct, ebp, fh

Examples


# Loading data - population and sample data
data("eusilcA_pop")
data("eusilcA_smp")

# Generate emdi object with additional indicators; here via function ebp()
emdi_model <- ebp(
  fixed = eqIncome ~ gender + eqsize + cash +
    self_empl + unempl_ben + age_ben + surv_ben + sick_ben + dis_ben + rent +
    fam_allow + house_allow + cap_inv + tax_adj, pop_data = eusilcA_pop,
  pop_domains = "district", smp_data = eusilcA_smp, smp_domains = "district",
  threshold = 11064.82, transformation = "box.cox",
  L = 50, MSE = TRUE, B = 50, custom_indicator =
    list(
      my_max = function(y) {
        max(y)
      },
      my_min = function(y) {
        min(y)
      }
    ), na.rm = TRUE, cpus = 1
)

# Example 1: Choose Gini coefficient, MSE and CV
gini <- estimators(emdi_model, indicator = "Gini", MSE = TRUE, CV = TRUE)
head(gini)
tail(gini)
as.data.frame(gini)
as.matrix(gini)
subset(gini, Domain = "Wien")

# Example 2: Choose custom indicators without MSE and CV
estimators(emdi_model, indicator = "Custom")


emdi documentation built on Nov. 5, 2023, 5:07 p.m.