ModelRisk example · General techniques
From a Survey to Probabilities: an Election
1,027 voters asked: how sure can we be who wins, and which alliance wins?
From the model’s saved run
Who gets the most votes
Shares of the votes cast: in the survey, and the uncertainty about the true share.
| Party | Said in the survey | Survey share | 10th pct | 90th pct | Chance of the most votes |
|---|---|---|---|---|---|
| SDP | 259 | 27.0% | 25.1% | 28.8% | 14.6% |
| SMP | 279 | 29.0% | 27.1% | 31.0% | 67.6% |
| PSM | 162 | 16.9% | 15.4% | 18.5% | 0.0% |
| EDP | 261 | 27.2% | 25.3% | 29.0% | 17.8% |
| Total | 100.0% |
S-curve (cumulative probability) of SDP, SMP, PSM, EDP from the saved simulation.
The business question
Before an election, 1,027 people were asked how they will vote: 259 SDP, 279 SMP, 162 PSM, 261 EDP, and 66 will not vote. SMP leads, but by only 2 points. How sure can we be that SMP wins? And if SDP allies with EDP, and SMP with PSM, which alliance gets more votes? The true shares are uncertain because only a sample was asked.
The Dirichlet distribution describes that uncertainty: each simulation draws one possible set of true shares, and each question becomes a 1/0 output whose mean is its probability.
- Who it is for
- Anyone turning survey or sample counts into uncertain shares: market shares from a panel, preferences from a customer survey, defect categories from an inspection sample, election polls.
- Main outputs
- Each party's share of the votes cast: survey value and 10th / 90th percentiles · the chance each party gets the most votes · the chance the SDP/EDP alliance beats SMP/PSM, simulated and exact, with five groups and with three.
How the model works
Three sheets after this one, read from left to right. Each one feeds the next.
Inputs sheet
How many people were asked and how many named each party; the rest will not vote.
Shares sheet
VoseDirichlet draws the five true shares (four parties and not voting) from the counts plus one each. Each party's share of the votes cast leaves out the non-voters. A 1/0 marks the party with the most. The alliances are answered twice: from the five shares, and from a Dirichlet over just the three groups the question needs, as the original example recommends.
Results sheet
Each party's share and its chance of the most votes; the alliance question simulated and exact.
ModelRisk techniques
Find similar models
- Product
- Type
- Application
- Uses
The results in detail
The alliances
Does SDP/EDP get more votes than SMP/PSM? Simulated, and exact (BETA.DIST).
S-curve (cumulative probability) of SDP/EDP − SMP/PSM, Tie from the saved simulation.
| Question | Simulated | Exact |
|---|---|---|
| SDP/EDP gets more votes: five groups | 99.43% | 99.455% |
| SDP/EDP gets more votes: three groups | 99.51% | 99.459% |
| Alliance margin, SDP/EDP − SMP/PSM: mean | 8.2% |
How to read these results
- SMP leads the survey with 29.0% of those who will vote, ahead of EDP (27.2%) and SDP (27.0%). Only 1,027 people were asked, so each true share is uncertain by about ±2 points (10th to 90th percentile).
- A 2-point lead is therefore not safe: SMP gets the most votes with a chance of about 68%, EDP about 18% and SDP about 15%. PSM, at 17%, cannot win.
- The alliances are another matter: SDP/EDP has 54% of the votes cast against 46% for SMP/PSM, a lead far beyond the survey's uncertainty. SDP/EDP gets more votes with a chance of 99.5%.
- Five groups or three: the Dirichlet adds one prior count to each group (the +1). The original example noted that splitting the vote into more groups than the question needs adds a little unneeded prior weight. Here it moves the exact answer by less than 0.01 points: with a survey this size the prior hardly matters.
- The survey is assumed to be a random sample, and nobody changes their mind before the election. Real polls carry more uncertainty than this.
See it move. Open the workbook, change an input on the Inputs sheet and run the simulation: every table and chart on this page updates in Excel.
Inputs and assumptions
Every assumption in the model, with its uncertainty and where it comes from. The figures are illustrative.
The survey 5 inputs
How many people were asked, and how many named each party. The rest will not vote.
| Assumption | Unit | Value |
|---|---|---|
| People askedA random sample of the voters | people | 1027 |
| Said SDP | people | 259 |
| Said SMP | people | 279 |
| Said PSM | people | 162 |
| Said EDP | people | 261 |
Units and conventions
- Share of the votes cast
- A party's share among those who vote: the non-voters left out.
- 1 = yes
- A question's output cell: 1 when the answer is yes in that simulation; its mean is the probability.
Key assumptions and limitations
- Random sample
- The 1,027 people are a random sample of the voters.
- No change of mind
- Everyone votes as they said in the survey (the original example's assumption).
- Prior
- Before the survey every split of the vote was equally likely (a uniform prior: one added to each count).
- Data
- The survey is that of ModelRisk's earlier Election example.
How to use it
- Enter your survey on the Inputs sheet.
- Run a simulation from the ModelRisk ribbon (10,000 samples with a fixed seed are set).
- Read the chances on the Results sheet. To ask a new question, add a 1/0 cell on the Shares sheet and mark it as an output: its mean is the probability.
ModelRisk functions used
- VoseDirichlet
- The uncertain true shares of several categories, adding up to 100%, from counts plus the prior.
- VoseOutput
- The shares and the 1/0 answers, recorded at every sample.
- VoseSimMean, VoseSimPercentile
- Statistics of the simulation: the mean of a 1/0 output is its probability.
- BETA.DIST
- Excel's Beta distribution: the exact chance that one of two groups is larger.
Further reading
- Monte Carlo simulation explained (Vose guide)
- Vose, D. (2008). Risk Analysis: A Quantitative Guide, 3rd edition. Wiley: the multinomial process and the Dirichlet distribution.
Download the workbook and run it yourself. It opens in Excel with ModelRisk. The free trial runs every example model.
Related example models
- ModelRisk★★★★★Bayesian Model AveragingWhen the data cannot tell which model is right, keep them all, weighted by how well each fits.Fitting several candidate models and mixing them by how well each explains the data; three kinds of model.
- ModelRisk★★★★★Extremes of Many Random VariablesThe largest and the smallest of 10,000 independent values, without sampling all 10,000.Sampling the largest or smallest of thousands of values directly, checked against the exact formula and against sampling them one by one.
- ModelRisk★★★★★Markov Chains: Marital Status in 25 YearsWhere will a group of 100 people be in 25 years?A population moving between four states each year, simulated two ways and checked against the exact expectation.
An illustrative example: the figures are invented for teaching and do not describe a real company, project or asset. Last updated 9 October 2026.