Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear fellow community members:
For the next [Scenario] Var1 will be defined and distroyed again. One might suggest to place the entire function in the If-statement instead of the Var1 value. Unfortunately, this is not possible as the first might produce a positive value while the second produces a negative value and then the whole point of the If-statement is gone. 😉
In conclusion, a Monte Carlo based on the concept described in Challenge 1 has my preference but one based on Challenge 2 is certainly workable and I am keen to learn about methods to solve the above described challenges.
A promise: if I succeed in creating a workable Monte Carlo simulator with user interaction in QlikView I will document the concepts and share with the community.
Looking forward to hear from you!
Jochem,
Following up on our LinkedIn discussion I have put together a proof-of-concept showing how to do Monte Carlo simulation of 2 problems.
1) Calculating the value of pi through simulation
2) Calculating the statistical failure rate of widget manufacturing given user inputs.
Everything is done through the script and equations in these examples (within attached qvw file). I think this addressing the problem you lay out fairly clearly in an easy to implement manner.
The biggest issue I've run across so far is that the chart for calculating pi doesn't work well for more than 100,000 random instances. Running more than a million instances for either can bog down calculations and potentially crash the computer.
Jochem,
I would like to get the files that you referenced on Doncqueurs' Wall. I've been asked to create an application that uses Monte Carlo methods to answer the following questions: 1) What is the probability that a new product's cash flows will have a positive net present value (NPV)? 2)What is the riskiness of our investment portfolio?
I would greatly appreciate any examples of Monte Carlo simulation in QlikView.
Jeanine
Hi,
Thanks for this example. I have done something similar for a different reason. Try this out:
Script:
for i=1 to 4
Let a$(i)=0;
next i
Load RowNo() as ID,
Rand() as Seed
Autogenerate 20000;
Now Create a Chart after loading the script:
Chart Type: Scatter Chart
Dimension : ID
Expression 1: If(ID=1,0,IF(Seed>0.93,Above(aX)*-0.15+0.28*above(aY),If(Seed>0.85,Above(aX)*0.2-0.26*Above(aY),If(Seed>0.01,Above(aX)*0.85+Above(aY)*0.04,0))))
Expression 1 BG Color: Green()
Expression 2:
If(ID=1,0,IF(Seed>0.93,Above(aX)*0.26+0.24*above(aY)+0.44,If(Seed>0.85,Above(aX)*0.26+0.24*Above(aY)+1.6,If(Seed>0.01,Above(aX)*-0.04+Above(aY)*0.85+1.6,0.16*Above(aY)))))
Enjoy...
Sorry, got truncated:
Expression 1:
If(ID=1,0,IF(Seed>0.93,Above(aX)*-0.15+0.28*above(aY),
If(Seed>0.85,Above(aX)*0.2-0.26*Above(aY),
If(Seed>0.01,Above(aX)*0.85+Above(aY)*0.04,0))))
Expression 2:
If(ID=1,0,IF(Seed>0.93,Above(aX)*0.26+0.24*above(aY)
+0.44,If(Seed>0.85,Above(aX)*0.26+0.24*Above(aY)+1.6,
If(Seed>0.01,Above(aX)*-0.04+Above(aY)*0.85+1.6,0.16*Above(aY)))))
I tried with 1 Million rows, and it works fine with pi value hovering around 3.13954
Though I am using a 64 bit Machine.