compute_z_aggregates: Compute z_ Aggregates from Monthly Microdata

View source: R/mensalize-sidra-series.R

compute_z_aggregatesR Documentation

Compute z_ Aggregates from Monthly Microdata

Description

Computes monthly z_ aggregates from PNADC microdata using calibrated monthly weights, with options for different population scaling approaches.

Usage

compute_z_aggregates(calibrated_data, verbose = TRUE)

Arguments

calibrated_data

PNADC microdata output from pnadc_apply_periods() with calibrate = TRUE. Must include weight_monthly, ref_month_yyyymm, and ref_month_in_quarter.

verbose

Print progress messages.

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.

Value

data.table with columns:

anomesexato

Integer YYYYMM month

z_*

Numeric weighted aggregates for each series (one column per series)

See Also

pnadc_apply_periods for the calibration step compute_series_starting_points for the y0 computation

Examples

## Not run: 
crosswalk <- pnadc_identify_periods(stacked_data)

calibrated <- pnadc_apply_periods(stacked_data, crosswalk,
                                   weight_var = "V1028",
                                   anchor = "quarter",
                                   calibration_unit = "month")

z_agg <- compute_z_aggregates(calibrated)

rq <- fetch_sidra_rolling_quarters()
y0 <- compute_series_starting_points(z_agg, rq)

## End(Not run)


PNADCperiods documentation built on April 28, 2026, 9:07 a.m.