Computes the variance estimation for measures of annual net change or annual for single and multistage stage cluster sampling designs.
vardannual(
Y,
H,
PSU,
w_final,
ID_level1,
ID_level2,
Dom = NULL,
Z = NULL,
gender = NULL,
country = NULL,
years,
subperiods,
dataset = NULL,
year1 = NULL,
year2 = NULL,
X = NULL,
countryX = NULL,
yearsX = NULL,
subperiodsX = NULL,
X_ID_level1 = NULL,
ind_gr = NULL,
g = NULL,
q = NULL,
datasetX = NULL,
frate = 0,
percentratio = 1,
use.estVar = FALSE,
use.gender = FALSE,
confidence = 0.95,
method = "cros"
)
Variables of interest. Object convertible to data.table
or variable names as character, column numbers.
The unit stratum variable. One dimensional object convertible to one-column data.table
or variable name as character, column number.
Primary sampling unit variable. One dimensional object convertible to one-column data.table
or variable name as character, column number.
Weight variable. One dimensional object convertible to one-column data.table
or variable name as character, column number.
Variable for level1 ID codes. One dimensional object convertible to one-column data.table
or variable name as character, column number.
Optional variables used to define population domains. If supplied, variables are calculated for each domain. An object convertible to data.table
or variable names as character vector, column numbers.
Optional variables of denominator for ratio estimation. If supplied, the ratio estimation is computed. Object convertible to data.table
or variable names as character, column numbers. This variable is NULL
by default.
Numerical variable for gender, where 1 is for males, but 2 is for females. One dimensional object convertible to one-column data.table
or variable name as character, column number.
Variable for the survey countries. The values for each country are computed independently. Object convertible to data.table
or variable names as character, column numbers.
Variable for the all survey years. The values for each year are computed independently. Object convertible to data.table
or variable names as character, column numbers.
Variable for the all survey sub-periods. The values for each sub-period are computed independently. Object convertible to data.table
or variable names as character, column numbers.
The vector of years from variable years
describes the first year for measures of annual net change.
The vector of years from variable periods
describes the second year for measures of annual net change.
Optional matrix of the auxiliary variables for the calibration estimator. Object convertible to data.table
or variable names as character, column numbers.
Optional variable for the survey countries. The values for each country are computed independently. Object convertible to data.table
or variable names as character, column numbers.
Variable of the all survey years. If supplied, residual estimation of calibration is done independently for each time period. Object convertible to data.table
or variable names as character, column numbers.
Variable for the all survey sub-periods. If supplied, residual estimation of calibration is done independently for each time period. Object convertible to data.table
or variable names as character, column numbers.
Variable for level1 ID codes. One dimensional object convertible to one-column data.table
or variable name as character, column number.
Optional variable by which divided independently X matrix of the auxiliary variables for the calibration. One dimensional object convertible to one-column data.table
or variable name as character, column number.
Optional variable of the g weights. One dimensional object convertible to one-column data.table
or variable name as character, column number.
Variable of the positive values accounting for heteroscedasticity. One dimensional object convertible to one-column data.table
or variable name as character, column number.
Optional survey data object in household level convertible to data.table
.
Positive numeric value. Sampling rate in percentage, by default - 0.
Positive numeric value. All linearized variables are multiplied with percentratio
value, by default - 1.
Logical value. If value is TRUE
, then R
function estVar
is used for the estimation of covariance matrix of the residuals. If value is FALSE
, then R
function estVar
is not used for the estimation of covariance matrix of the residuals.
Logical value. If value is TRUE
, then subperiods
is defined together with gender
.
optional; either a positive value for confidence interval. This variable by default is 0.95.
character value; value 'cros' is for measures of annual or value 'netchanges' is for measures of annual net change. This variable by default is netchanges.
Optional
Optional
A list with objects are returned by the function:
crossectional_results
- a data.table
containing:
year
- survey years,
subperiods
- survey sub-periods,
country
- survey countries,
Dom
- optional variable of the population domains,
namesY
- variable with names of variables of interest,
namesZ
- optional variable with names of denominator for ratio estimation,
sample_size
- the sample size (in numbers of individuals),
pop_size
- the population size (in numbers of individuals),
total
- the estimated totals,
variance
- the estimated variance of cross-sectional or longitudinal measures,
sd_w
- the estimated weighted variance of simple random sample,
sd_nw
- the estimated variance estimation of simple random sample,
pop
- the population size (in numbers of households),
sampl_siz
- the sample size (in numbers of households),
stderr_w
- the estimated weighted standard error of simple random sample,
stderr_nw
- the estimated standard error of simple random sample,
se
- the estimated standard error of cross-sectional or longitudinal,
rse
- the estimated relative standard error (coefficient of variation),
cv
- the estimated relative standard error (coefficient of variation) in percentage,
absolute_margin_of_error
- the estimated absolute margin of error,
relative_margin_of_error
- the estimated relative margin of error,
CI_lower
- the estimated confidence interval lower bound,
CI_upper
- the estimated confidence interval upper bound,
confidence_level
- the positive value for confidence interval.
crossectional_var_grad
- a data.table
containing:
year
- survey years,
subperiods
- survey sub-periods,
country
- survey countries,
Dom
- optional variable of the population domains,
namesY
- variable with names of variables of interest,
namesZ
- optional variable with names of denominator for ratio estimation,
grad
- the estimated gradient,
var
- the estimated a design-based variance.
vardchanges_grad_var
- a data.table
containing:
year_1
- survey years of years1
,
subperiods_1
- survey sub-periods of years1
,
year_2
- survey years of years2
,
subperiods_2
- survey sub-periods of years2
,
country
- survey countries,
Dom
- optional variable of the population domains,
namesY
- variable with names of variables of interest,
namesZ
- optional variable with names of denominator for ratio estimation,
nams
- gradient names, numerator (num) and denominator (den), for each year,
grad
- the estimated gradient,
cros_var
- the estimated a design-based variance.
vardchanges_rho
- a data.table
containing:
year
- survey years of years
for cross-sectional estimates,
subperiods
- survey sub-periods of years
for cross-sectional estimates,
year_1
- survey years of years1
,
subperiods_1
- survey sub-periods of years1
,
year_2
- survey years of years2
,
subperiods_2
- survey sub-periods of years2
,
country
- survey countries,
Dom
- optional variable of the population domains,
namesY
- variable with names of variables of interest,
namesZ
- optional variable with names of denominator for ratio estimation,
nams
- gradient names, numerator (num) and denominator (den), for each year,
rho
- the estimated correlation matrix.
vardchanges_var_tau
- a data.table
containing:
year_1
- survey years of years1
,
subperiods_1
- survey sub-periods of years1
,
year_2
- survey years of years2
,
subperiods_2
- survey sub-periods of years2
,
country
- survey countries,
Dom
- optional variable of the population domains,
namesY
- variable with names of variables of interest,
namesZ
- optional variable with names of denominator for ratio estimation,
nams
- gradient names, numerator (num) and denominator (den), for each year,
var_tau
- the estimated covariance matrix.
vardchanges_results
- a data.table
containing:
year
- survey years of years
for measures of annual,
subperiods
- survey sub-periods of years
for measures of annual,
year_1
- survey years of years1
for measures of annual net change,
subperiods_1
- survey sub-periods of years1
for measures of annual net change,
year_2
- survey years of years2
for measures of annual net change,
subperiods_2
- survey sub-periods of years2
for measures of annual net change,
country
- survey countries,
Dom
- optional variable of the population domains,
namesY
- variable with names of variables of interest,
namesZ
- optional variable with names of denominator for ratio estimation,
estim_1
- the estimated value for period1,
estim_2
- the estimated value for period2,
estim
- the estimated value,
var
- the estimated variance,
se
- the estimated standard error,
CI_lower
- the estimated confidence interval lower bound,
CI_upper
- the estimated confidence interval upper bound,
confidence_level
- the positive value for confidence interval,
significant
- is the the difference significant
X_annual
- a data.table
containing:
year
- survey years of years
for measures of annual,
year_1
- survey years of years1
for measures of annual net change,
year_2
- survey years of years2
for measures of annual net change,
period
- period1 and period2 together,
country
- survey countries,
Dom
- optional variable of the population domains,
namesY
- variable with names of variables of interest,
namesZ
- optional variable with names of denominator for ratio estimation,
cros_se
- the estimated cross-sectional standard error.
A_matrix
- a data.table
containing:
year
- survey years of years1
for measures of annual,
year_1
- survey years of years1
for measures of annual net change,
year_2
- survey years of years2
for measures of annual net change,
country
- survey countries,
Dom
- optional variable of the population domains,
namesY
- variable with names of variables of interest,
namesZ
- optional variable with names of denominator for ratio estimation,
cols
- the estimated matrix_A columns,
matrix_A
- the estimated matrix A.
annual_sum
- a data.table
containing:
year
- survey years,
country
- survey countries,
Dom
- optional variable of the population domains,
namesY
- variable with names of variables of interest,
namesZ
- optional variable with names of denominator for ratio estimation,
totalY
- the estimated value of variables of interest for period1,
totalZ
- optional the estimated value of denominator for period2,
estim
- the estimated value for year.
annual_results
- a data.table
containing:
year
- survey years of years
for measures of annual,
year_1
- survey years of years1
for measures of annual net change,
year_2
- survey years of years2
for measures of annual net change,
country
- survey countries,
Dom
- optional variable of the population domains,
namesY
- variable with names of variables of interest,
namesZ
- optional variable with names of denominator for ratio estimation,
estim_1
- the estimated value for period1 for measures of annual net change,
estim_2
- the estimated value for period2 for measures of annual net change,
estim
- the estimated value,
var
- the estimated variance,
se
- the estimated standard error,
rse
- the estimated relative standard error (coefficient of variation),
cv
- the estimated relative standard error (coefficient of variation) in percentage,
absolute_margin_of_error
- the estimated absolute margin of error for period1 for measures of annual,
relative_margin_of_error
- the estimated relative margin of error in percentage for measures of annual,
CI_lower
- the estimated confidence interval lower bound,
CI_upper
- the estimated confidence interval upper bound,
confidence_level
- the positive value for confidence interval,
significant
- is the the difference significant
Guillaume Osier, Virginie Raymond, (2015), Development of methodology for the estimate of variance of annual net changes for LFS-based indicators. Deliverable 1 - Short document with derivation of the methodology. Guillaume Osier, Yves Berger, Tim Goedeme, (2013), Standard error estimation for the EU-SILC indicators of poverty and social exclusion, Eurostat Methodologies and Working papers, URL http://ec.europa.eu/eurostat/documents/3888793/5855973/KS-RA-13-024-EN.PDF. Eurostat Methodologies and Working papers, Handbook on precision requirements and variance estimation for ESS household surveys, 2013, URL http://ec.europa.eu/eurostat/documents/3859598/5927001/KS-RA-13-029-EN.PDF. Yves G. Berger, Tim Goedeme, Guillame Osier (2013). Handbook on standard error estimation and other related sampling issues in EU-SILC, URL https://ec.europa.eu/eurostat/cros/content/handbook-standard-error-estimation-and-other-related-sampling-issues-ver-29072013_en
# NOT RUN {
### Example
library("data.table")
set.seed(1)
data("eusilc", package = "laeken")
eusilc1 <- eusilc[1:20, ]
rm(eusilc)
dataset1 <- data.table(rbind(eusilc1, eusilc1),
year = c(rep(2010, nrow(eusilc1)),
rep(2011, nrow(eusilc1))))
rm(eusilc1)
dataset1[, country := "AT"]
dataset1[, half := .I - 2 * trunc((.I - 1) / 2)]
dataset1[, quarter := .I - 4 * trunc((.I - 1) / 4)]
dataset1[age < 0, age := 0]
PSU <- dataset1[, .N, keyby = "db030"][, N := NULL][]
PSU[, PSU := trunc(runif(.N, 0, 5))]
dataset1 <- merge(dataset1, PSU, all = TRUE, by = "db030")
rm(PSU)
dataset1[, strata := "XXXX"]
dataset1[, employed := trunc(runif(.N, 0, 2))]
dataset1[, unemployed := trunc(runif(.N, 0, 2))]
dataset1[, labour_force := employed + unemployed]
dataset1[, id_lv2 := paste0("V", .I)]
vardannual(Y = "employed", H = "strata",
PSU = "PSU", w_final = "rb050",
ID_level1 = "db030", ID_level2 = "id_lv2",
Dom = NULL, Z = NULL, years = "year",
subperiods = "half", dataset = dataset1,
percentratio = 100, confidence = 0.95,
method = "cros")
# }
# NOT RUN {
vardannual(Y = "employed", H = "strata",
PSU = "PSU", w_final = "rb050",
ID_level1 = "db030", ID_level2 = "id_lv2",
Dom = NULL, Z = NULL, country = "country",
years = "year", subperiods = "quarter",
dataset = dataset1, year1 = 2010, year2 = 2011,
percentratio = 100, confidence = 0.95,
method = "netchanges")
vardannual(Y = "unemployed", H = "strata",
PSU = "PSU", w_final = "rb050",
ID_level1 = "db030", ID_level2 = "id_lv2",
Dom = NULL, Z = "labour_force",
country = "country", years = "year",
subperiods = "quarter", dataset = dataset1,
year1 = 2010, year2 = 2011,
percentratio = 100, confidence = 0.95,
method = "netchanges")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab