## Solving Complex Probabilistic Problems Through Simulation

*[Please note that the following article — while it has been updated from our newsletter archives — may not reflect the latest software interface and plot graphics, but the original methodology and analysis steps remain applicable.]*

The invention of the Monte Carlo simulation method is credited to Stanislaw Ulam, a Polish-born mathematician who worked for John von Neumann on the United States' Manhattan Project during World War II. He devised the method, which involves the use of repeated experiments to estimate a solution, in 1946 while pondering the probabilities of winning a card game of solitaire.

To begin to understand how the Monte Carlo simulation method can be used to analyze probabilistic problems, consider a simple example. To estimate the probability of rolling a given number with a single die, one option is to use a computer to simulate a large number of dice rolls (randomly generating a number from 1 to 6 during each simulation) and count the number of times that the number appears. The percentage of times that the number appears across all simulations provides an estimate of the probability.

This method can be applied to solve much more complex problems in a variety of areas, including risk analysis, safety analysis, reliability modeling, maintenance planning, optimization, operational research, financial analysis, etc. The following examples demonstrate three possible applications. ReliaSoft's new RENO software is used to perform each analysis.

**Example 1 - Warranty
Prediction Based on Variable Usage
**Reliability analysis for a certain snow blower yielded a Weibull
life distribution with Beta = 2 and Eta = 400 hours. Although the
reliability of the snow blower is known, the usage in various regions of the
country is variable. For this example, suppose that the snow blower will be
deployed in a part of the country where the probability that it will snow on
any given winter day is 1 in 10. If it snows, then the snow depth is
normally distributed with Mean = 6 inches and Standard Deviation = 2.
Furthermore, the area of the driveways in that region is also normally
distributed with Mean = 300 square feet and Standard Deviation = 40.

If the snow blower clears 30 cubic feet an hour, what would the reliability of the blower be over 100 winter days?

**Simulation Solution
**It is possible to create a flowchart that models the reliability
and usage scenario described for the snow blower. This model will rely on a
collection of defined variables that represent the probabilities and other
characteristics for the given scenario. There are likely to be many
different ways to model any given scenario. One approach to solving this
problem would require the definition of the following variables:

**Probabilities**

- The probability that it will snow on any given winter day: 1 in 10 or 0.10

**Random Variables**

- The amount of snowfall on the days that it snows: Normal (6, 2)
- The area of the driveways in the region: Normal (300, 40)

**Equations**

- The snow blower usage for 100 winter days, which can be calculated based on the amount of snowfall, the area of the driveways and rate at which the blower clears the snow: (((Snowfall_inches/12)*Area_to_clean_ft2)/30)

A flowchart model can then be constructed as shown in Figure 1.

**Figure 1: Flowchart Model
for Snow Blower Example**

In this model, the simulation determines whether it snowed on a given day by randomly generating a number from 1 to 10 (uniform probability) and then comparing it to the fixed probability of snow on any given winter day (0.10). If the randomly generated number is less than or equal to the fixed probability, this indicates that it snowed and the simulation uses the equation described above to calculate the snow blower usage hours for that day. Figure 2 shows the Conditional Block construct that is used in the RENO software to instruct the simulation to perform this check.

**Figure 2: The Conditional
Block from the RENO Flowchart passes the calculated snow blower usage hours
on days when it snows**

The Weibull Reliability function returns the reliability for a given time based on a Weibull distribution with specified parameters. The average hours of snow blower usage that are estimated by the simulation can then be used as the Time input to this function, as shown in Figure 3. The reserved keyword IN inserts the usage value from the previous construct in the flowchart.

**Figure 3: The Weibull
Reliability function estimates reliability for the given usage hours**

When this flowchart model has been simulated 1,000 times, the reliability for the snow blower under the specified usage conditions is estimated to be 98.5975%.

**Example 2 - Risk
Analysis: Manufacturing Variability**

A certain chemical is added during the production of a suntan lotion and the
manufacturing process contains some minor variability. The concentration of
chemical X is normally distributed with Mean = 0.005 and Standard Deviation
= 0.0001 ml of chemical X per ml of lotion. The amount of lotion applied by
a person also varies and is known to be normally distributed with Mean = 100
ml and Standard Deviation = 20 ml. It is suspected that 10% of the
population may, depending on the amount used, have an allergic reaction to
chemical X. From the 10% who are susceptible, the probability that someone
will have an allergic reaction is a function of the amount of the chemical
applied. This probability is given by a Weibull distribution with Beta = 2.5
and Eta = 1.8.

Determine the percentage of the population that is expected to experience an allergic reaction.

**Simulation Solution
**One approach to solving this problem via simulation would require
the definition of the following variables:

**Random Variables**

- The concentration of the chemical in the lotion: Normal (.005, .0001)
- The amount of lotion applied by a user: Normal (100, 20)

**Equations**

- The amount of the chemical applied by a user, which can be calculated by multiplying the concentration of the chemical by the amount of lotion applied

**Probabilities**

- The probability that the user will have a reaction, which is based on the amount of chemical applied and Weibull (2.5, 1.8)

A flowchart model can then be constructed, as shown next.

In this model, the simulation randomly generates values for the concentration of the chemical and the amount of lotion applied based on the specified distributions and parameters. It then calculates the amount of chemical applied by the user based on the specified equation. Finally, it determines the probability of a reaction based on the specified distribution/parameters and the amount of chemical applied. Figure 4 shows the construct used within the RENO flowchart to generate the desired result as a percentage.

**Figure 4: RENO construct to
estimate the percentage of users who experience an allergic reaction**

When this flowchart model has been simulated 2,000 times, the percentage of the population that will experience an allergic reaction to the suntan lotion is estimated to be .4203%.

**Example 3 -
Financial Analysis of Investment Strategies
**In planning for your retirement, let's assume that you are
choosing to invest some of your money in the bank and some in the stock
market (NASDAQ and tied to the NASDAQ Composite Index). After researching
the two investment vehicles, you determine the following:

- The interest from the bank investment follows a generalized gamma distribution with Mean = 1.7406, Standard Deviation = 0.1141 and Lambda = 4.3106.
- The profit from the NASDAQ investment follows a normal distribution with Mean = 13 and Standard Deviation = 28.

You will choose to invest X% of your income per year for the next Y years. Assume that your current income is $40,000 per year and, based on past history, that your income will increase yearly by a percentage that is normally distributed with Mean = 4 and Standard Deviation = 1.5.

You will decide to put Z% of your investment money in the bank for the first year and the remainder in NASDAQ. Given the volatility of NASDAQ, any profits made in the stock market at the end of each year will be transferred into the savings account for safe keeping. In addition, the amount invested in NASDAQ will not increase as your income increases every year. It will always be equal to the first year investment.

When planning your retirement strategy, you may wish to perform the following analyses:

- Estimate your investment income over the next 20 years if you invest 5% of your yearly income with 50% going to savings.
- Compare your investment income after 20 years, varying the investment portion from 0% to 20% of your yearly income (with 50% going to savings).
- Compare your investment income after 20 years, varying the investment portion from 0% to 20% of your yearly income and varying the amount invested in savings from 0% to 100%.

**Simulation Solution
**The flowchart in Figure 5 shows one approach to obtaining the
desired results via simulation.

**Figure 5: Flowchart for retirement strategy analysis**

As in the previous examples, this model relies on probabilities, constants and other variables that are defined based on the conditions of the scenario. For example, Random Variables are used to obtain the returns expected from each investment vehicle based on the specified distributions/parameters. Equation Variables are used to calculate the amount of money that will be placed into each investment vehicle each year, and so on.

When the variables and flowchart model have been defined, you can vary the simulation options to obtain the results of interest. First, to estimate your income over the next 20 years for a given investment strategy, you can use RENO's Sensitivity Analysis feature to perform a separate simulation run for each year from 1 to 20. After the software has performed 1,000 simulations for the first year, 1,000 simulations for the second year, and so on up to 20 years, the results from each run can be plotted against time, as shown in Figure 6.

**Figure 6: Investment income over 20 years**

Next, to compare your income after 20 years when investing various percentages of your salary, you can use the Sensitivity Analysis feature to perform a separate simulation run for each percentage. After the software has performed 1,000 simulations for 0%, 1,000 simulations for 1% and so on up to 20%, the results from each run can be plotted against investment percentages, as shown in Figure 7.

**Figure 7: Investment income at 20 years with varied investment
percentages**

Finally, to compare the investment income at various percentages of your salary and with various portions of the investment going to each vehicle, you can instruct the software to vary both constants and perform separate simulation runs for each combination. The 3-D plot in Figure 8 shows the results for investing 0 to 20% of your salary with 0 to 100% of that amount invested in the stock market.

**Figure 8: Investment income at 20 years with varied investment portions
and percentages**

**Conclusion
**As this article demonstrates, simulation can be a powerful tool
for analyzing complex problems in a variety of areas. The RENO software
provides a visual, intuitive and flexible way to construct flowcharts to
model any probabilistic scenario and then use simulation to estimate
results of interest. More information is available on the Web at
http://www.reliasoft.com/products/reliability-analysis/reno.