Skip to contents

Function summarize_indicators reports point and mean squared error (MSE) estimates as well as calculated coefficients of variation (CV) from a fitted SAEforest object.

Usage

summarize_indicators(object, indicator = "all", MSE = FALSE, CV = FALSE)

Arguments

object

Object for which point and/or MSE estimates and/or calculated CV's are requested. The object must be of class SAEforest.

indicator

Optional character vector specifying indicators to be mapped: (i) all calculated indicators ("all"); (ii) each default indicators name: "Mean", "Quant10", "Quant25", "Median", "Quant75", "Quant90", "Gini", "Hcr", "Pgap", "Qsr" or the function name/s of "custom_indicator/s"; (iii) a vector of names of indicators. If the object is estimated by SAEforest_model indicator arguments are ignored and only the "Mean" is returned.

MSE

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

CV

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

Value

The return of summarize_indicators is an object of class summarize_indicators.SAEforest

including domain-specific point and/or MSE estimates and/or calculated CV's from a SAEforest object The returned object contains the data.frame ind and a character including the names of requested indicator(s).

Details

Objects of class summarize_indicators.SAEforest 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).

Examples

# \donttest{
# Loading data
data("eusilcA_pop")
data("eusilcA_smp")

income <- eusilcA_smp$eqIncome
X_covar <- eusilcA_smp[, -c(1, 16, 17, 18)]

# Calculating point + MSE estimates and passing arguments to the forest.
# Additionally, two additional indicators and functions as threshold are added.
# Note that B and num.trees are low to speed up estimation time and must be changed for
# practical applications.

model1 <- SAEforest_model(Y = income, X = X_covar, dName = "district",
                          smp_data = eusilcA_smp, pop_data = eusilcA_pop,
                          meanOnly = FALSE, MSE = "nonparametric", B = 5, mtry = 5,
                          num.trees = 50, smearing = FALSE)
#> Error in initializePtr(): function 'cholmod_factor_ldetA' not provided by package 'Matrix'

# Extract indicator and show generics:
Gini1 <- summarize_indicators(model1, MSE = TRUE, CV = TRUE, indicator = "Gini")
#> Error in eval(expr, envir, enclos): object 'model1' not found

head(Gini1)
#> Error in eval(expr, envir, enclos): object 'Gini1' not found
tail(Gini1)
#> Error in eval(expr, envir, enclos): object 'Gini1' not found
as.data.frame(Gini1)
#> Error in eval(expr, envir, enclos): object 'Gini1' not found
as.matrix(Gini1)
#> Error in eval(expr, envir, enclos): object 'Gini1' not found
subset(Gini1, district == "Wien")
#> Error in eval(expr, envir, enclos): object 'Gini1' not found
# }