Shows weighted data on specified variables compared to targets and baseweights.
weightassess(inputter, dataframe, weightvec, prevec = NULL)
The inputter
object should contain a list of all target values for the raking procedure. Each list element in inputter
should be a vector corresponding to the weighting targets for a single variable. Hence, the vector enumerating the weighting targets for a variable with 2 levels should be of length 2, while a vector enumerating the weighting targets for a variable with 5 levels should be of length 5. List elements in inputter should be named according to the variable that they will match in the corresponding dataset. Hence, a list element enumerating the proportion of the sample that should be of each gender should be labeled "female" if the variable in dataframe
is also titled "female."
inputter
elements must be vectors and can be of class numeric, or factor and must match the class of the corresponding variable in dataframe
. Logical variables in dataframe
can be matched to a numeric vector of length 2 and ordered with the TRUE
target as the first element and the FALSE
target as the second element. Targets for factors must be labeled to match every level present in the dataframe (e.g. a variable with 2 age groups "under40" and "over40" should have elements named "under40" and "over40" respectively). anesrake
attempts to conform any unrecognized types of vectors to class(numeric)
. Weighting targets can be entered either as an N to be reached or as a percent for any given variable. Targets can be either proportions (ideal) or the number of individuals in the population in each target category (N). Totals of greater than 1.5 for any given list element are treated as Ns, while values of less than 1.5 are treated as percentages.
The dataframe
command identifies a data.frame
object of the data to be weighted. The data.frame must contain all of the variables that will be used in the weighting process and those variables must have the same names as are present in the inputter
list element.
weightvec
is a vector of final weights that are to be assessed.
prevec
is an optional input if some kind of base weights, stratification correction, or other sampling probability of note that should be accounted for before weighting is conducted. If defined, prevec
must be of a length equivalent to the number of cases in the dataframe
. If undefined, prevec
will be automatically seeded with a vector of 1s.
Prints out a list of all levels of all variables named in inputter. For each variable, shows values weighted with prevec, weightvec, and the targets and assesses discrepancies for each.