*! version 1.4 Aug 07 2015

Title

surveybias -- Calculate various measures of bias in survey

Syntax

surveybias
varname
[if] [in]
[weight]
, POPvalues(#..#) [VERBose] [prop] [vce(vcetype)] [cluster clustvar] [svy] [subpop(var)] [level(#)]

Immediate command: surveybiasi

Command for aggregated data (series of surveys): surveybiasseries

Description

surveybias compares the distribution of categorical variable varname
in the dataset to its true distribution in the population, which is specified as a
numlist in POPvalues(#..#)

Options

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

VERBose displays detailed information on varname.

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

bootstrap, by, jackknife and statsby are allowed, see prefix.

vce, cluster uses complex variance estimators. Cluster, bootstrap, and jacknife estimators are allowed. Switches to numerical methods.

svy uses survey characteristics of your data. Switches to numerical methods and requires that the survey design variables be identified using
svyset

subpop(var) identifies subpopulation for use with survey estimator. Implies svy

aweights, fweights, iweights, and pweights are allowed; see weight.

level(#) sets confidence level.

Remarks

Values of varname must be strictly positive integers. The number of
categories must not exceed twelve. The order of categories in POPvalues and
varname must match. If in doubt, use VERBose, or inspect varname.
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

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

Examples

. use onefrenchsurvey, replace

. surveybias vote, popval(28.6 27.18 17.9 9.13 11.1 2.31 1.15 1.79 0.8)

Saved results

surveybias 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

e(depvar) name of variable in sample

Matrices

e(b) coefficient vector

e(V) variance-covariance matrix of the estimators

Functions

e(sample) marks estimation sample

Also see

surveybiasi (immediate calculation of B and friends) surveybiasi

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

Online: mgof