Dynsimpie

Stata module to examine dynamic compositional dependent variables

View the Project on GitHub

dynsimpie

A Stata program to examine dynamic compositional dependent variables.

Download

The most recent version of dynsimpie is available on this page. The program can also be found on the SSC RePEc archive, though that link has not been updated in a while.

Table of Contents

Description

dynsimpie is a program to dynamically examine compositional dependent variables, detailed in Philips, Rutherford, and Whitten (2016) and used in Philips, Rutherford, and Whitten (2015). Their modeling strategy uses an error correction model within a seemingly unrelated regression to simulate dynamic changes in each compositional dependent variable in response to a counterfactual “shock” to an independent variable during the simulation. Following the work of Aitchison (1986), the program first expresses the dependent variables in compositional form using a log-ratio transformation. dynsimpie then models the first differenced series of each compositional ratio as a function of their lag, as well as the lag and first difference of a vector of independent variables. Expected values are calculated, and, since compositional log ratios are not particularly intuitive, these are then “un-transformed” and the expected (or predicted) average proportion of each dependent variable over time is either graphed and/or saved to a dataset, along with associated confidence intervals.

Requirements

To use dynsimpie, the user must first download and install the Clarify package by King, Tomz, and Wittenberg (2000) (estsimp and setx).

Syntax

dynsimpie indepvars [if] [in] [, options]

Required options

Additional options

Reference

If you use dynsimpie, please cite us:

Philips, Andrew Q., Amanda Rutherford, and Guy D. Whitten. 2016. “dynsimpie: A command to examine dynamic compositional dependent variables.” Stata Journal 16(3):662-677.

and

Philips, Andrew Q., Amanda Rutherford, and Guy D. Whitten. 2016. “Dynamic pie: A strategy for modeling trade-offs in compositional variables over time.” American Journal of Political Science 60(1): 268-283.

Authors

Andrew Q. Philips, University of Colorado at Boulder, Boulder, CO. andrew.philips [AT] colorado.edu

Amanda Rutherford, Indiana University, Bloomington, IN

Guy D. Whitten, Texas A&M University, College Station, TX

Citations

Aitchison, John. 1986. The statistical analysis of compositional data. Chapman & Hall, Ltd.

Philips, Andrew Q., Amanda Rutherford, and Guy D. Whitten. 2016. “Dynamic pie: A strategy for modeling trade-offs in compositional variables over time.” American Journal of Political Science 60(1): 268-283.

Philips, Andrew Q., Amanda Rutherford, and Guy D. Whitten. 2015. “The dynamic battle for pieces of pie–Modeling party support in multi-party nations.” Electoral Studies 39:264-274.

Tomz, Michael, Jason Wittenberg and Gary King. 2003. “CLARIFY: Software for interpreting and presenting statistical results.” Journal of Statistical Software 8(1):1-30.

Examples

Open the UK data from Philips, Rutherford, & Whitten (2016), which contains data on the proportion of support for the Conservatives (Con), Liberal Democrats (Ldm), and Labour (Lab), during the New Labour government period.

use UK_AJPS.dta, clear

a 1 standard deviation increase of Labour as best manager of the economy at t = 9. By specifying the graph option, dynsimpie automatically produces a time-series plot of the simulations. Note that the results from the seemingly unrelated regression equations are also shown.

dynsimpie all_pidW all_LabLeaderEval_W all_ConLeaderEval_W all_LDLeaderEval_W all_nat_retW, ///
 dvs(Lab Con Ldm) t(9) shock(0.054) shockvar(all_b_mii_lab_pct) graph

first sim

Alternatively, we can open the dataset that dynsimpie produces and graph the results. Note that the program takes the first component in dvs( ) to use as the baseline. When it gets untransformed, this ends up as the LAST predicted category; since we specified dvs(Lab Con Ldm), mid1, mid2, and mid3 correspond with predictions for Con, Ldm, and Lab, respectively.

use dynsimpie_results.dta, clear
twoway rspike var1_pie_ul_ var1_pie_ll_ time || rspike var2_pie_ul_ var2_pie_ll_ time ||   ///
 rspike var3_pie_ul_ var3_pie_ll_ time || scatter mid1 time || scatter mid2 time ||        ///
 scatter mid3 time, legend( order(4 "Conservatives" 5 "Lib Dems" 6 "Labour")) xtitle("Month")     ///
 ytitle("Predicted Proportion of Support")

second sim

a 1 standard deviation increase of survey respondents who think Labour is the best manager of the economy, along with a 1 standard deviation increase in Labour leader evaluations at time t=18 with range t=45.

dynsimpie all_pidW all_ConLeaderEval_W all_LDLeaderEval_W all_nat_retW ,                  ///
 dvs(Lab Con Ldm) t(18) range(45) shock(0.054) shockvar(all_b_mii_lab_pct)            ///
 shockvar2(all_LabLeaderEval_W) shock2(0.367) nograph
use dynsimpie_results.dta, clear
twoway rspike var1_pie_ul_ var1_pie_ll_ time || rspike var2_pie_ul_ var2_pie_ll_ time ||  ///
 rspike var3_pie_ul_ var3_pie_ll_ time || scatter mid1 time || scatter mid2 time ||       ///
 scatter mid3 time, legend( order(4 "Conservatives" 5 "Lib-Dems" 6 "Labour")) xtitle("Month")    ///
 ytitle("Predicted Proportion of Support")

third sim

The same as above but generate predicted values instead of expected values.

dynsimpie all_pidW all_ConLeaderEval_W all_LDLeaderEval_W all_nat_retW ,                  ///
 dvs(Lab Con Ldm) t(18) range(45) shock(0.054) shockvar(all_b_mii_lab_pct)            ///
 shockvar2(all_LabLeaderEval_W) shock2(0.367) nograph pv
use dynsimpie_results.dta, clear
twoway rspike var1_pie_ul_ var1_pie_ll_ time || rspike var2_pie_ul_ var2_pie_ll_ time ||  ///
 rspike var3_pie_ul_ var3_pie_ll_ time || scatter mid1 time || scatter mid2 time ||       ///
 scatter mid3 time, legend( order(4 "Conservatives" 5 "Lib-Dems" 6 "Labour")) xtitle("Month")    ///
 ytitle("Predicted Proportion of Support") 

fourth sim

Example Papers

Use dynsimpie in one of your papers? Let me know (aphilips [AT] pols.tamu.edu) and I will add it to the list below: