*! version 1.4 Aug 07 2015

Title

surveybiasi -- Immediate command for calculating
various measures of bias in survey

Command for raw data (single survey): surveybias

Command for aggregated data (series of surveys): surveybiasseries

Syntax

surveybiasi
, POPvalues(#..#) SAMPLEvalues(#..#)
n(#) [level(#)] [prop]

Description

surveybiasi compares the distribution of categorical
variable in a sample SAMPLEvalues(#..#) to its true
distribution in the population, which is specified as a numlist
in POPvalues(#..#)

Options

POPvalues specify distribution of in the population.
Must not be omitted. Distribution can be given as counts or relative
frequencies, as it is rescaled to unity.

SAMPLEvalues specify distribution of variable in the
population. Must not be omitted. Distribution can be given as counts
or relative frequencies, as it is rescaled to unity.

n(#) specifies sample size. Must not be omitted.

prop Switch to estimation via proportion. Chiefly used for testing.

level(#) sets the confidence level.

Remarks

The number of categories must not exceed twelve. The order of
categories must match. For detailed information on A', B and B_w, see
Arzheimer, Kai and Jocelyn Evans, A New Multinomial Accuracy Measure
for Polling Bias, Political Analysis, Political Analysis 2014 (22), 31-44.
http://dx.doi.org/10.1093/pan/mpt012

Proportions must be strictly positive. If a category is not
observed at all, consider merging it with other categories. If the
category needs to be retained, you may enter its proportion as a very
small fraction (say 10^-6), but the estimates could be numerically
unstable.

For very small samples and/or sparse tables, an exact chi-square as implemented
in mgof (ssc describe mgof) should be used.

Examples

. surveybiasi , popvalues(30 40 30) samplevalues(40 40 20) n(1000)

Saved results

surveybiasi saves the following in e():

Scalars

e(N) number of observations

e(chi2p) Pearson chi-square value

e(chi2lr) likelihood-ratio chi-square value

e(df) degrees of freedom for goodness-of-fit test

e(pp) p-value based on Pearson chi-square

e(plr) p-value based on likelihood-ratio
chi-square

Macros

e(cmd) surveybias

e(cmdline) command as typed

e(properties) b V

Matrices

e(b) coefficient vector

e(V) variance-covariance matrix of the estimators

Also see

surveybias (calculation of B and friends from raw data in
memory) surveybias

surveybiasseries (calculation of B for a series of surveys from
a dataset of margins) surveybiasseries

Online: mgof