Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 4898 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

2012so.fp7.zip

I'm trying to make a calculator, where I've designated 38 States + DC as being safe for a particular party (all going the same way as 2008, except one EC vote from NE's 2nd CD, which I give back to Republicans), and now I want to be able to enter percentage chances of the Democrat winning each of the 12 remaining states, and have the filemaker database figure out the odds of the Democrat winning the whole election, based on those percentages.

I have 12 number fields, to enter the percentage chance of the Democrat winning each of the 12 states in question, and one calculation field, to determine the percentage chance of the Democrat winning the whole election.

270towin.com shows 325 combinations for Democrat winning, with my 12 states remaining. You can see these combinations here - http://www.270towin....A,NV,NH&me=&ne=

I used that to make the following calculation field, but the results do not seem accurate (in a lot of instances they look right (FL, PA, OH, and MI are enough to win. If I set those to 50% each and the rest to 0% it returns 6.25%, which is right (.5^4)) but sometimes the result is clearly wrong - if I set MI, NC, VA, and IN to 100%, any of FL, PA, or OH, would be enough to win, so if I set those to 50% each, the odds should be 87.5% (1-.5^3), but the calculation field turns up 99.5893806219100953; there are many similar situations where it's clearly wrong. Leaving those 4 at 100, everything else at 0, and FL at 50, it returns 75% when it should be 50%), and I don't, for the life of me, understand why (I've attached the file 2012so.fp7.zip):

Let ( [ rfl= fl/100 ;rpa= pa/100 ;roh= oh/100 ;rmi= mi/100 ;rnc= nc/100 ;rva= va/100 ;rin= in/100 ;rwi= wi/100 ;rco= co/100 ;rnv= nv/100 ;ria= ia/100 ;rnh= nh/100 ] ;

Let ( [ifl=1-rfl;ipa=1-rpa;ioh=1-roh; imi=1-rmi;inc=1-rnc;iva=1-rva;iin=1-rin;iwi=1-rwi;ico=1-rco; inv=1-rnv;iia=1-ria;inh=1-rnh ] ;

1-(

(1-rFL*rPA*rOH*(1-(iMI*iNC*iVA*iIN*iWI*iCO*iIA*iNV*iNH)))

*(1-rFL*rPA*rMI*(1-(iNC*iVA*iIN*iWI*iCO*iIA*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NV*rNH)

*(1-rPA*rVA*rIN*rWI*rIA*rNV*rNH)

*(1-rPA*rVA*rIN*rCO*rIA*rNV*rNH)

*(1-rOH*rMI*rVA*rCO*rIA*rNV*rNH)

*(1-rOH*rMI*rIN*rWI*rIA*rNV*rNH)

*(1-rOH*rMI*rIN*rCO*rIA*rNV*rNH)

*(1-rOH*rMI*rWI*rCO*rIA*rNV*rNH)

*(1-rOH*rNC*rVA*rWI*rIA*rNV*rNH)

*(1-rOH*rNC*rVA*rCO*rIA*rNV*rNH)

*(1-rOH*rNC*rIN*rWI*rIA*rNV*rNH)

*(1-rOH*rNC*rIN*rCO*rIA*rNV*rNH)

*(1-rOH*rVA*rIN*rWI*rCO*rNV*rIA)

*(1-rOH*rVA*rIN*rWI*rCO*rIA*rNH)

*(1-rOH*rVA*rIN*rWI*rCO*rNV*rNH)

*(1-rMI*rNC*rVA*rIN*rIA*rNV*rNH)

*(1-rMI*rNC*rVA*rWI*rIA*rNV*rNH)

*(1-rMI*rNC*rVA*rCO*rIA*rNV*rNH)

*(1-rMI*rNC*rIN*rWI*rCO*rNV*rIA)

*(1-rMI*rNC*rIN*rWI*rCO*rIA*rNH)

*(1-rMI*rNC*rIN*rWI*rCO*rNV*rNH)

*(1-rMI*rVA*rIN*rWI*rCO*rNV*rIA)

*(1-rMI*rVA*rIN*rWI*rCO*rIA*rNH)

*(1-rMI*rVA*rIN*rWI*rCO*rNV*rNH)

*(1-rNC*rVA*rIN*rWI*rCO*rNV*rIA)

)))*100

Posted

I don't understand your calculation at all. Why don't you break it into several stages, so that you can check the result at each point.

I would start by calculating the combined probability of "all of these" states. Then calculate the probability of "at least one of these" states. Finally, multiply the two. This should be a three-liner, not the monster you are showing.

Of course, you should also break the probabilities into individual records and use relationships to group them (use either a custom function or logarithms to derive the product of a group).

Posted

I've vaguely figured out the source of the problem. I'm still thinking through how to fix it.

I think it's a problem with my statistical methodology;

I think it has to do with over-applying combinations.

For example, if I set MI, NC, and VA to 100%, Florida would be enough to win, so if I set Florida to 50% (leaving everything else at 0), the odds are 50%. But, if I change IN to 100%, the odds change to 75%, when it should still be 50%, because FL is still the deciding factor, and FL is still at 50%. It seems like change IN from 0% to 100% puts more combinations in play, and increases the odds, when it shouldn't. So, it would seem my methodology was wrong, but I'm still not sure how to do it correctly.

I guess this isn't really a Filemaker problem, but rather just one of me not being infallible at statistics. If anyone happens to be great at statistics and can quickly figure out the right methodology, I'd appreciate it, but otherwise this thread should probably be ignored, since it seems the issue isn't a filemaker issue.

This topic is 4898 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.