Compute z_ Aggregates from Monthly Microdata
Source:R/mensalize-sidra-series.R
compute_z_aggregates.RdComputes monthly z_ aggregates from PNADC microdata using calibrated monthly weights, with options for different population scaling approaches.
Arguments
- calibrated_data
PNADC microdata output from
pnadc_apply_periods()withcalibrate = TRUE. Must includeweight_monthly,ref_month_yyyymm, andref_month_in_quarter.- verbose
Print progress messages.
Value
data.table with columns:
- anomesexato
Integer YYYYMM month
- z_
Numeric weighted aggregates for each series
Details
This function creates z_ indicator variables and aggregates them using the
calibrated weight_monthly from pnadc_apply_periods().
The pnadc_apply_periods() function implements the calibration
methodology as follows:
All months are scaled uniformly to SIDRA monthly population totals.
This function simply aggregates the indicators using the already-calibrated weights.
See also
pnadc_apply_periods for the calibration step
compute_series_starting_points for the y0 computation
Examples
if (FALSE) { # \dontrun{
# Step 1: Build crosswalk
crosswalk <- pnadc_identify_periods(stacked_data)
# Step 2: Calibrate weights
calibrated <- pnadc_apply_periods(stacked_data, crosswalk,
weight_var = "V1028",
calibration_unit = "month")
# Step 3: Compute z_ aggregates using calibrated weights
z_agg <- compute_z_aggregates(calibrated)
# Step 4: Compute starting points
rq <- fetch_sidra_rolling_quarters()
y0 <- compute_series_starting_points(z_agg, rq)
} # }