*! version 1.0.1 6FEB2014

*! version 1.0.2 8MAY2014

*! version 1.0.3 26JUN2014

Title

qv -- Quasi variances

Syntax

qv
varlist
[, options]

options description

ref(string) names the reference group; ref_grp if not specified

level(#) sets the confidence interval between 0 to 100; default is 95

plot a basic graph for variables in varlist

saving(filename[, replace]) save graph

Description

qv is a post-estimation command. It uses e(V) from the most recently fit model to compute
quasi variances (Firth 2003) for all categories in a multi-category variable.

The varlist accepts either the (n-1) dummy variables of the multi-category variable,
or its equivalent factor variable in the form of i.group. In both cases,
varlist has to be part of the most recently fit estimation command.

In addition to the tabulated output, qv also returns results with better precision
in the stored matrices e(qv), e(qvub), and e(qvlb).

The user-written glm link function glm_exp is required to execute qv.

Options

ref(string) names the reference category when the varlist contains (n-1) dummy
variables . If not specified, ref_grp is assigned.

level(#) specifies the level of confidence interval. It accepts numeric values between
0 and 100. The default is 95.

plot generates a standard graph for the point estimate and confidence intervals based
on quasi standard errors. For making customizable graphs, use qvgraph or refer to the
example below.

saving(filename,[replace,]) saves the graph produced by the option plot.

Examples

. sysuse census, clear
. gen dpop=death/pop*1000

Use the factor variable

. reg dpop i.region medage
. qv i.region, level(95) plot

Or use the (n-1) dummy variables

. gen NC=region==2
. gen SO=region==3
. gen WS=region==4
. reg dpop NC SO WS medage
. qv NC SO WS, ref(NE) level(95) plot

Create graph from the stored matrices

. mat lb=e(qvlb)
. mat ub=e(qvub)
. svmat lb, names(lb)
. svmat ub, names(ub)
. gen b=(lb1+ub1)/2

. gen group=_n in 1/4
. label variable group "Region"
. label define region 1 "NE" 2 "NC" 3 "SO" 4 "WS"
. label value group region

. graph twoway scatter b group || rspike ub1 lb1 group, vert ///
legend(off) ytitle("") xlabel(, valuelab)

Graphic comparison with regular standard errors

. gen lb2=0
. gen ub2=0
. replace lb2=b-1.96*_se[NC] if _n==2
. replace ub2=b+1.96*_se[NC] if _n==2
. replace lb2=b-1.96*_se[SO] if _n==3
. replace ub2=b+1.96*_se[SO] if _n==3
. replace lb2=b-1.96*_se[WS] if _n==4
. replace ub2=b+1.96*_se[WS] if _n==4

. graph twoway scatter b group || rspike ub2 lb2 group, vert ///
legend(off) ytitle("") xlabel(, valuelab) ///
title("regular standard errors") name(regular)

. graph combine regular qv
(click to reproduce graphs)

Stored results

qv adds the following to existing matrices:

Matrices

e(qv) quasi variances

e(qvlb) qv-based lower-bound estimates

e(qvub) qv-based upper-bound estimates

Technical details

qv first estimates the generalized linear model using iterative reweighted least
square (irls) methods. If an error is returned, maximum likelihood methods are attempted.

Users can also use the Quasi Variance Caculator hosted at the Unversity of Warwick.
(http://www2.warwick.ac.uk/fac/sci/statistics/staff/academic-research/firth/software/qvcalc/kuvee/)

References

Firth, David. 2003. ¡§Overcoming the Reference Category Problem in the Presentation of Statistical Models.¡¨Sociological Methodology 33(1): pp 1¡V18.

Contact

For questions and comments, please email aspenchensoc@gmail.com.