Use of Dummy Varibles

52 views
Skip to first unread message

jtr...@gmail.com

unread,
Jul 25, 2013, 8:34:24 PM7/25/13
to eureqa...@googlegroups.com
I'm an Eureqa Newbie (just downloaded the software) with probably a really stupid question, but I am hoping someone can help me.

First off sorry about the political topic here, but I am trying to figure out the effects of gun laws on violent crime rates.

# of violent crime per capita is my independent variable

The dependent variables that I have are:

a = population density
b = average home price
c = average education level
d = distance from police stations
e = if concealed handguns are outlawed

My last variable, e, is a dummy variable.  I set it to 0 in areas that don't allow concealed handguns and set it to 1 in areas that do.

When I use Eureqa to try and fit an equation to all these data, it comes up with an equation using a, b, c, & d.  However, if doesn't use e at all in the equation.  So at first I was thinking, "ok so this shows that gun laws have no effect on crime rates."

However, then I took the residuals (observed data - Eureqa equation), and i just plotted these in excel.  Through a little bit of manual work, I found that I could improve the objective function (mean squared error) by 2% by just adding in a linear term with e to my equation.

So from all this my question is does Eureqa just not work at fitting dummy variables?  Or what techniques do i need to use to get it to incorporate a dummy variable into my equation?

Thanks in advance for the help.

Jon

benedict gbg

unread,
Jul 26, 2013, 8:31:50 AM7/26/13
to eureqa...@googlegroups.com
You can force Eureka to basically calculate 2 different sets of functions based on your dummy variable

z = if(e=1, f1(a,b,c,d), f2(a,b,c,d))

It's a very interesting question though, so I'd like to see if there's a more elegant and faster solution.

Alison Reynolds

unread,
Jul 26, 2013, 8:54:31 AM7/26/13
to eureqa...@googlegroups.com
Hi Jon,

What you're doing sounds ok; you shouldn't need to do anything special with that variable.  I'm not sure if you can share your data but if you want to upload or email the project I'm happy to take a look to see if anything jumps out.

Alison

jtr...@gmail.com

unread,
Jul 26, 2013, 2:40:37 PM7/26/13
to eureqa...@googlegroups.com
Thanks for the replies.


Benedict, you idea helped.  I actually did something similar.  I did

y = f1(a,b,c,d) + f2(e)

This equation "forced" Eureqa to include variable e in the equation.


Alison, thanks for the offer, but for now I think I am good.  I might take you up on that offer in the future if I run into more issues :-).
Reply all
Reply to author
Forward
0 new messages