Page 1 of 2
How to use "Random Lookup"
Posted: Thu Apr 27, 2006 7:06 am
by xhoward
Hi,
does anyone have any idea about the use of
"Random Lookup" function?
I kind of feel confused about the 1st augment of this function? Would you please provide an example?
Thanks,
Howard
Posted: Thu Apr 27, 2006 9:52 am
by bob@vensim.com
The first argument is the name of the lookup function that describes the shape of the distribution. EG
uniform lookup((0,1),(1,1))
Note that the x range does not actually matter as Vensim integrates the lookup and adjusts everything to give the mean value specified.
Posted: Fri Apr 28, 2006 1:15 am
by xhoward
Thanks for your guidances.
However, I still can't use the function smoothly.
The situation is there is a X(min:0 max:100 unit:%)
Y=f(X)(Y min:0 Max:1 unit:Dmnl).
I want to let the f(X)=Random Lookup(x1,x2,x3,x4,x5,x6)
I have tried many times but the first argument seems to
"miss right hand parenthesis."
Sorry for my disturbance. I'd really appreciate any available suggestions from you.
Regards,
Howard
Posted: Fri Apr 28, 2006 9:56 am
by bob@vensim.com
sounds like you are using Vensim PLE which does not have RANDOM LOOKUP.
Posted: Fri Apr 28, 2006 1:23 pm
by xhoward
Actually I'm using Vensim DSS.
(Lots of Random functions are embedded.)
And I just feel so confused.@@
Posted: Fri Apr 28, 2006 2:07 pm
by xhoward
Hi, Bob,
I think it would be better to describe my question more specifically.
As I mentioned above, my goal is to create a lookup function
in whcih Y goes up from 0 to 1 while X rises from 0% to 100%.
Hence Y can multiply by another variable Z and its value will exhbit a "random incremental" form.
For the sake of this, I try to use RandomLookup to acheive my goal.
If you have better suggestions or any alternative, please kindly let me know.
I'm on the threshold of learning SD and using Vensim DSS.
There is still too much for me to learn...
A thousand thanks,
Howard
[Edited on 4-28-2006 by xhoward]
lookup function
Posted: Fri Apr 28, 2006 2:31 pm
by LAUJJL
Hi
You'd better send a simplistic model to explain what you are trying to do. I do not see actually your problem.
regards.
JJ
Posted: Sat Apr 29, 2006 1:58 am
by xhoward
Hi, JJ,
I have mailed a model to you.
If it's available, would you please help me check the
RandomLookup function in the model?
I'd appreciate any suggestions from you.
Thanks,
Howard
Posted: Sat Apr 29, 2006 11:28 am
by bob@vensim.com
I don't really understand exactly what you are trying to do either, but I am guessing that it is actually some sort of accumulation of a random variables. I am attaching a model the uses the random lookup function, and also accumulates a random variable. Perhaps this will be helpful.
lookup
Posted: Sat Apr 29, 2006 1:08 pm
by LAUJJL
Hi
I still do not understand what you want to do.
But one can make several remarks about your model.
First to avoid an error unit, it is better to define a constant for the initial value of x and to use it for the determination of %x finished.
Secondly you define the variable Random lookup as a lookup, which is impossible. A function lookup is essentially a constant that is defined at the start of the time and stays constant afterwards. One could imagine that you define your lookup with equations, making it vary with the time, but you cannot do it with Vensim lookups.
So if you want to introduce a lookup you have to settle its values independently of any other ones.
Thirdly, the y1 function is wrong.
(Y*RandomLookup)/Y2: The RandomLookup must have a parameter like RandomLookup(Y) for example.
Do you have studied the chapter on lookup in the Vensim user's guide?
You could read too the chapter on lookups in Sterman's business dynamic too.
Joined a model with the unit correction.
Regards.
JJ
lookup
Posted: Sun Apr 30, 2006 11:14 am
by LAUJJL
Hi
In the third remark, I wrote about one parameter, in fact it must have the lookup table as parameter and the boundaries, plus the stretch and the slide.
If you want to introduce some noise using a lookup function,
it is better to use a lookup with a distribution choosen by you, and use the result to modify the result given by tye %xfinished.
I will post one example of model later on.
Regards.
JJ
lookup
Posted: Sun Apr 30, 2006 3:31 pm
by LAUJJL
Hi
I join a model that brings noise to the percentage of work finished. The problem is that bringing noise to a ratio that must be between 0 and 1 is not easy. Even if you do it, the noise introduces a bias that is measured by accumulating both values, biased and unbiased.
I do not know how to correct this to introduce noise that preserves the ration between 0 and 1, while preserving the average value of the ratio.
Probably the administrators have a solution.
I have the same problem introducing noise into observed data, that I suspect to be biased, and wanting to see the influence of an eventual bias on other results.
Regards.
JJ
Posted: Mon May 01, 2006 1:03 am
by bob@vensim.com
There is no generic solution to this. If the purpose is, for example, to measure fraction complete on a project with error you could use something like:
measured fraction complete = RANDOM NORMAL(0,1,
fraction complete,max standard deviation*(1-fraction complete),0)
HOWEVER PLEASE NOTE: I would never use this in a project model. The most serious error in measuring fraction complete comes from the existence of undiscovered rework and that is a common project model structure that requires no random variables at all. See chapter 3 of the Modeling Guide for some examples.
Posted: Mon May 01, 2006 7:38 am
by xhoward
Hi,
Actually I want to model the conurrency between company X & company Y.
The % finished in stock X (Unit:Tasks) may determine the percentage of taks in stock Y that are capable of being exectuted.
For example, when X finishes 50%, 50% of Y can be done, then X finishes the remaining, and finally 100% of Y can be finished. (Discrete Concurrency)
Because there is no precise data about the concurreny between X & Y,
I try to use random lookup to depict the scenario.
I hope the explanation helps you all understand what I really want to do.
Thanks for Bob & JJ's assistance.
Regards,
Howard
lookup
Posted: Mon May 01, 2006 2:11 pm
by LAUJJL
Hi
Joined a model where I have implemented Bob's solution that works well in term of keeping the average of %xfinished randomize close to the %xfinished.
I have joined two other options, both with Random uniform, one with the time, that work already fine, the random uniform a little less than the Normal and the uniform plus the time a little better.
I use often the random uniform because in my models I am not sure of the parameters that are not biased by error of observations that can be represented by normal distributions but by other biases not independant and not numerous. I have then to consider the parameter varying in a uniform manner.
Regards.
JJ
lookup
Posted: Mon May 01, 2006 2:22 pm
by LAUJJL
Hi Howard
I still do not undesrstand quite how you want to depict the concurrency. It would eventually be better if you represent somehow the demand.
Regards.
JJ
Posted: Tue May 02, 2006 10:13 am
by bob@vensim.com
I looked at this and still don't really understand it. Variable names like X and Y make it difficult for me.
However, if the idea is to say that the ability to do work on one task depends upon the perception of completion of another task this model is not a good representation. The noise should enter on the perceived progress rate on the first task, not its accumulation. That is
perceived work complete task 1 = INTEG(perceived progress rate task 1,0)
perceved progress rate task 1 = actul progress rate + {or*} noise term
If you want to put in a correction so that as actual completion on task 1 approaches 100% the perception of it is forced to also converge that makes sense.
You should read Richardson & Pugh - this perception complete is closely analogous to detection of undiscovered rework.
Posted: Sat Nov 08, 2008 1:51 pm
by tangent
Originally posted by bob@vensim.com
The first argument is the name of the lookup function that describes the shape of the distribution. EG
uniform lookup((0,1),(1,1))
Note that the x range does not actually matter as Vensim integrates the lookup and adjusts everything to give the mean value specified.
I am having trouble with RANDOM LOOKUP and found this thread. I changed my input lookup to the uniform distribution suggested to try and understand what is going on. I don't understand how to specify 'mean value' The inputs are min, max, shift and stretch. The manual is very confusing about how these relate to mean. Min and max appear to be truncation points. Neither of the others has an actual description of what it does to the input lookup.
I have one other related problem. The random lookup is being used to determine the delay period as the input to a DELAY CONVEYOR. I am also getting a units error as the delay should be in timestep units but the random function wants to generate dimensionless output.
Please advise, Jen
[Edited on 8-11-2008 by tangent]
Random lookup
Posted: Sat Nov 08, 2008 3:26 pm
by LAUJJL
Hi
The best thing is to join a simplistic model, even if there are errors in it.
It will be easier to understand what you want.
Regards.
JJ
Posted: Sat Nov 08, 2008 10:13 pm
by tangent
Model attached
Posted: Sun Nov 09, 2008 11:45 am
by bob@vensim.com
In the case of RANDOM LOOKUP the min and max determine the full range of output - not truncation points. The mean value is then determined by the shape of the specified lookup function - it is not an argument to the function. For simplicity it is usually best to have the x axis on the lookup run from 0 to 1. Then the mean value of the random function is given by
min + mean value of lookup * (max - min)
There is not, unfortunately, any obvious function to determine the mean value of the lookup.
As far as units - the message is that the stretch parameter (5th) must be dimensionless. It is probably best to use a shift of 0 and stretch of 1 for this function and then use the min and max to adjust the output.
Posted: Sun Nov 09, 2008 1:57 pm
by tangent
Thank you for the response. I have revised the model to reflect the min/max use of rescaling. However, I interpreted the lookup input as the probability density function (without worrying about integral being 1). I have used a strongly skewed input test function and the output of the random lookup is much less skewed.
Also, to give you some context, this component is part of a simple drug uptake/quit model and the delay is intended to replicate prison sentences. That is, the stock is users currently in prison and the random lookup is the length of the sentence. I haven't quite worked out how to do the initial profile for the delay either.
Revised model attached with rescale set to 1 month to 10 years.
[Edited on 9-11-2008 by tangent]
Posted: Mon Nov 10, 2008 10:34 am
by bob@vensim.com
Your interpretation of the lookup is correct here does appear to be something wrong with the profile of the resulting noise stream. I will have to look into this more closely to figure out what is going on.
Posted: Mon Nov 10, 2008 11:43 am
by tangent
Thanks Bob. The way I would expect it to work is something like:
1/ Convert 'probability function' to cumulative function
2/ Normalise to cumulative probability function by dividing cumulative function by total
3/ Then I think you need the inverse of that function, so that
4/ From a uniform random distribution [0,1] on y axis, use the inverse of the cdf to get back to value (on x axis)
If this is the algorithm you are using, it would probably be easier to use the cdf as the input to the lookup.
Jen
Posted: Mon Nov 10, 2008 12:51 pm
by bob@vensim.com
Sorry about this - you were right the first time - the documentation is unclear and I explained it incorrectly.
The Lookup that is input is the PDF and the values on the x-axis are the range for the PDF. Thus if you call it with
RANDOM LOOKUP(DelayShape, -1e9, 1e9, 0, 1, 0)
you will get an output that has the same distirbution as DelayShape. Making DelayShape run from 0 to 1 means you would need to use
RANDOM LOOKUP(DelayShape, -1e9,1e9,TargetMin, (TargetMax-TargetMin), 0)
to get the results you want.
What was happening with your old formulation was Vensim was generating a number between 0 and 1, then continually rejecting it since it was not in range. After a while it gives up and draws a uniform number on the range and returns that. That is why you got the distribution you did, and also why the simulation was so slow.
The method for getting an arbitrary result is indeed the inverse of the cumulative function, though the implementation does not actually require the determination of this inverse at all points.