cluelessresearch.com

political methodology, brazilian politics, etc.

Archive for July, 2006

From tables to graphs

I embarked on a paper project with John Kastellec to document the use of statistical tables versus graphs in political science and provide examples about how many (even most) of the tables can be transformed into graphs. That is, we aim to do for a political science audience what Andrew Gelman and coauthors did for statistics.

The main reason we use tables is because, well, they are a hundred times (or more) easier to produce. In that respect, our plan is to provide code showing how we did the examples and also provide functions that transforms what we identified as most frequent kinds of tables into (hopefully beautiful) graphs. We aim, therefore, to make it easy the translation from tables to graphs.

For the time being, the code and examples will be hosted here at brazilianpolitics.org. My first contribution is a function that takes a matrix correlations and produces a image plot like the figure 8 in Zhengy, Salganikz and Gelman “How many people do you know in prison?: Using overdispersion in count data to estimate social structure in networks”, JASA 101(474): 409-423.

(links to code and graphs always point to the latest version, and are continually updated. use it at your own risk.)

Read more

Comments are off for this post

Total effects

Question for the stats experts:

There are three equations, with the same set of independent variables (which we combine in
the matrix X.)
[tex] risk1=X\gamma+e_1 [/tex]

[tex] risk2=X\zeta+e_2 [/tex]

[tex] cc=X\beta+\delta_1 risk1 + \delta_2 risk2 + e_3 [/tex]

we can rewrite cc as:

[tex] cc=X\beta+\delta_1 (X\gamma+e_1) + \delta_2 (X\zeta+e_2) + e_3 [/tex]

[tex] =X\beta+\delta_1 (X\gamma+e_1) + \delta_2 (X\zeta+e_2) + e_3 [/tex]

[tex] =X\beta+X(\delta_1\gamma) + X(\delta_2\zeta) +e_1\delta_1+e_2\delta_2+ e_3 [/tex]

Assume that the covariances between [tex]e_1,e_2[/tex] and [tex]e_3[/tex] are all zero and let [tex]r=e_1\delta_1+e_2\delta_2+ e_3[/tex]. Then we have the following equation

[tex] cc=X(\beta+\delta_1\gamma+\delta_2\gamma)+r [/tex]

Can this be estimated by least squares? Does it yield an estimate of the “total effect” as refered to in the path analysis/structural equation modelling literature?

2 comments

LaTeX in Wordpress

I plan to keep this blog as a way to track my progress on my dissertation. Math is needed sometimes, and to typeset math nothing beats LaTeX. I installed the LaTeX plugin for Wordpress so I can TeX away in my posts.

[tex] y_{ij}\sim \alpha+\beta_i x_{ij} [/tex]

Cool, right? I bet you can’t do that in blogger or whatever.

(You wouldn’t spend time trying to do it as well, but this one was a quick install.)

4 comments

Presidential Elections Page

I created a page to keep track of the 2006 Presidential elections polls (with pretty graphs!) I plan to keep it updated on a weekly basis. Comment
on the plot and other suggestions welcome in this post.

files:

data (stata format)

code (R, using ggplot)

1 comment