Dear Hillard,
Note that both plots display the same information, but that the axes
have been transformed.
In general, for plot.ci, you want to enter the primary term first,
because that will be the reference point for the axis. Using a squared
term (whether centered or not) on the x-axis does not make sense
because the axis cannot be interpreted directly without some mental
math. (And the whole point of a graph is to facilitate
interpretation!)
If you are interested in plot.ci, I recommend that you read the zelig
help for plot.ci (at
http://gking.harvard.edu/zelig/docs/commandsRd/plot.ci.pdf) and the
source code, available when you type plot.ci (without parentheses) at
the command prompt. The plot.ci function passes additional plotting
parameters to the lower-level functions via ..., so any option
available described in help(par) is also available.
Best,
Olivia
On Mon, Apr 27, 2009 at 12:51 AM, Hillard Pouncy
<hillard.pouncy(a)gmail.com> wrote:
Dear Olivia
Here's what I did. I just changed the order in which I entered the
variables from the model I described earlier:
z.outblksq <- zelig(PTURN100 ~ meblkvar * PDEM100 + I(meblkvar^2) +PIND100 +
ENTRPY10 + MINC1000, model = "ls", data = turnc)
In the first attached file labeled blksq.pdf, I entered the variable
I(medblkvar^2) first. In the second attached file I entered the non-squared
variable (medblkvar) first. Same terms, just entered in a different order.
The two graphs tell the same story, but they are strikingly different. For
the first one, blksq.pdf, the main effect on the x axis is a race variable
and zero on the X-axis equals districts where the black population is 50
percent (high diversity). As values on the x axis increase districts
become less diverse. Because the variable was first centered before being
squared districts with the same value could be composed of mostly blacks or
mostly non-blacks. The moderating variable Percent Democratic does a good
job of pulling the districts apart so that those that are primarily black
(and primarily Democratic) separate from those that are primarily non-black
districts (and less Democratic).
The second one graph, blksqs.pdf is more straight forward and here the main
effect is a race variable on the x-axis. It is centered so that negative
values capture less black districts and positive values capture mostly black
districts. Again Percent Democratic is the moderating variable and again it
separates the districts nicely.
I am happy that the Zelig plot package changes its presentation depending
upon how the variables are entered, but is there a write up somewhere that
spells out the rules Zelig is using so that I might have even more control
over my presentation strategy?
Thanks,
Hillard Pouncy
On Sun, Apr 26, 2009 at 5:33 PM, Olivia Lau <olivia.lau(a)post.harvard.edu>
wrote:
Dear Hillard,
From your code, I can't tell what the alternative model is. In the
code you sent, you get the primary effect of meblkvar because you have
PDEM100*meblkvar in your formula, which is expanded to PDEM100 +
mebklvar + I(PDEM100 * mebklvar). Since the expanded formula has both
meblkvar + I(meblkar^2), you should expect the quadratic effect.
The plot.ci function simply takes the first of the two terms (in the
order you entered them) as the axis label; since you entered
I(meblkvar^2) first, that's the axis label. Thus, if you use
z.outblksq <- zelig(PTURN100 ~ meblkvar * PDEM100 + I(meblkvar^2) +
PIND100 + ENTRPY10 + MINC1000, model = "ls", data = turnc)
you should get meblkvar as the axis label. You can, of course,
specify the x axis label by using
plot.ci(...., xlab = "Whatever meblkvar stands for")
Best,
Olivia
On Sun, Apr 26, 2009 at 5:24 PM, Hillard Pouncy
<hillard.pouncy(a)gmail.com> wrote:
> Does the variable order in an equation affect the plot outcome?
> I calculated this equation z.outblksq <-zelig(PTURN100 ~ I(meblkvar^2) +
> PIND100 +PDEM100 * meblkvar + ENTRPY10 + MINC1000, model = "ls", data =
> turnc) with a quadratic terms first. I ran a simulation on the
> interaction
> terms
> x.xlow <-setx(z.outblksq, meblkvar = -45:50, PDEM100 = 35)
>> x.xhigh <-setx(z.outblksq, meblkvar = -45:50, PDEM100=95)
>> s.outblksq <-sim(z.outblksq, x = x.xlow, x= x.xhigh)
> The plot.ci command produced a plot I did not expect that used the
> quadratic
> term for the x axis.
> I like the plot, but I don't understand what happened.
> I changed the variable in an alternative model and the term on the x
> axis
> was the non-quadratic variable I expected (meblkvar).
> Can anybody explain this one?
> best
> Hillard Pouncy
-
Zelig Mailing List, served by Harvard-MIT Data Center
Send messages: zelig(a)lists.gking.harvard.edu
[un]subscribe Options:
http://lists.gking.harvard.edu/?info=zelig
Zelig program information:
http://gking.harvard.edu/zelig/