Description Usage Arguments Details Value References See Also Examples
View source: R/direct_estimation.R
Function direct
estimates indicators only based on sample information.
The variance is estimated via a naive or calibrated bootstrap. The estimation
is adapted from the estimation of direct indicators in package
laeken.
1 2 3 4 
y 
a character string indicating the variable that is used for estimating the indicators. The variable must be contained in the sample data. 
smp_data 
survey data containing variable y as well as sampling domains, and weights if selected. 
smp_domains 
a character containing the name of a variable that indicates domains in the sample data. The variable must be numeric or a factor. 
weights 
a character string containing the name of a variable for
the sampling weights in the sample data. This argument is optional and defaults
to 
design 
a character string containing the name of a variable for different
strata for stratified sampling designs. This argument is optional and defaults
to 
threshold 
a number defining a threshold. Alternatively, a threshold may
be defined as a 
var 
if 
boot_type 
a character string containing the name of the bootstrap
specification. Either a 
B 
a number determining the number of bootstrap populations for the
bootstrap variance. Defaults to 
seed 
an integer to set the seed for the random number generator. Random
number generation is used in the bootstrap approach. If seed is set to

X_calib 
a numeric matrix including calibration variables if the calibrated bootstrap is chosen. Defaults to NULL. 
totals 
a numeric vector providing the population totals if the calibrated
bootstrap is chosen. If a vector is chosen, the length of the vector needs to
equal the number of columns in X_calib. Defaults to 
custom_indicator 
a list of functions containing the indicators to be
calculated additionally. Such functions must and must only depend on the
target variable 
na.rm 
if 
The set of predefined indicators includes the mean, median, four further quantiles (10%, 25%, 75% and 90%), head count ratio, poverty gap, Gini coefficient and the quintile share ratio.
An object of class "emdi" that provides direct estimators for regional
disaggregated indicators and optionally corresponding variance estimates. Generic
functions such as estimators
, print
and summary
have methods that can be used
to obtain further information. See emdiObject
for descriptions
of components of objects of class "emdi".
Alfons, A. and Templ, M. (2013). Estimation of Social Exclusion Indicators
from Complex Surveys: The R Package laeken. Journal of
Statistical Software, 54(15), 125.
Social Protection Committee (2001). Report on Indicators in the Field of
Poverty and Social Exclusions, Technical Report, European Union.
emdiObject
, lme
,
estimators.emdi
, print.emdi
,
summary.emdi
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24  ## Not run:
# Loading sample data
data("eusilcA_smp")
# Example 1: Without weights and naive bootstrap
emdi_direct < direct(y = "eqIncome", smp_data = eusilcA_smp,
smp_domains = "district", weights = "weight", threshold = 11064.82, var = TRUE,
boot_type = "naive", B = 50, seed = 123, X_calib = NULL, totals = NULL,
na.rm = TRUE)
# Example 2: With function as threshold
emdi_direct < direct(y = "eqIncome", smp_data = eusilcA_smp,
smp_domains = "district", weights = "weight", threshold =
function(y, weights){0.6 * laeken::weightedMedian(y, weights)}, na.rm = TRUE)
# Example 3: With custom indicators
emdi_direct < direct(y = "eqIncome", smp_data = eusilcA_smp,
smp_domains = "district", weights = "weight", threshold = 10859.24,
var = TRUE, boot_type = "naive", B = 50, seed = 123, X_calib = NULL,
totals = NULL, custom_indicator = list(my_max = function(y, weights,
threshold){max(y)}, my_min = function(y, weights, threshold){min(y)}),
na.rm = TRUE)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.