This function reweights and aggregates estimates from dgirt for strata defined by modeled variables. The names of each of the model's time, geographic, and demographic grouping variables can be given in either the strata_names or aggregated_names argument. The result has estimates for the strata indicated by the strata_names argument, aggregated over the variables specified in aggregated_names. poststratify requires a table given as target_data with population proportions for the interaction of the variables given in strata_names and aggregated_names.

poststratify(x, target_data, strata_names, aggregated_names,
  proportion_name = "proportion", ...)

# S4 method for dgo_fit
poststratify(x, target_data, strata_names, aggregated_names,
  proportion_name = "proportion", pars = "theta_bar")

# S4 method for data.frame
poststratify(x, target_data, strata_names,
  aggregated_names, proportion_name = "proportion")

Arguments

x

A data.frame or dgo_fit object.

target_data

A table giving the proportions contributed to strata by the interaction of strata_names and aggregated_names.

strata_names

Names of variables whose interaction defines population strata.

aggregated_names

Names of variables to be aggregated over in poststratification.

proportion_name

Name of the column in target_data that gives strata proportions.

...

Additional arguments to methods.

pars

Selected parameter names.

Value

A table of poststratified estimates.

Examples

# NOT RUN {
data(toy_dgirtfit)

# the stratifying variables should uniquely identify proportions in the
# target data; to achieve this, sum over the other variables
targets <- aggregate(proportion ~ state + year + race3, targets, sum)

# the dgirtfit method of poststratify takes a dgirtfit object, the target
# data, the names of variables that define population strata, and the  names
# of variables to be aggregated over
post <- poststratify(toy_dgirtfit, targets, c("state", "year"), "race3")
# }