How to use "Random Lookup"

Use this forum to post Vensim related questions.
xhoward
Junior Member
Posts: 12
Joined: Thu Apr 27, 2006 7:03 am

How to use "Random Lookup"

Post 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
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post 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.
xhoward
Junior Member
Posts: 12
Joined: Thu Apr 27, 2006 7:03 am

Post 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
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

sounds like you are using Vensim PLE which does not have RANDOM LOOKUP.
xhoward
Junior Member
Posts: 12
Joined: Thu Apr 27, 2006 7:03 am

Post by xhoward »

Actually I'm using Vensim DSS.
(Lots of Random functions are embedded.)
And I just feel so confused.@@
xhoward
Junior Member
Posts: 12
Joined: Thu Apr 27, 2006 7:03 am

Post 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]
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

lookup function

Post 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
xhoward
Junior Member
Posts: 12
Joined: Thu Apr 27, 2006 7:03 am

Post 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
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post 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.
Attachments
randomthings.mdl
(1.89 KiB) Downloaded 558 times
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

lookup

Post 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
Attachments
RandomLookup_2.mdl
(2.6 KiB) Downloaded 518 times
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

lookup

Post 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
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

lookup

Post 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
Attachments
RandomLookup_3.mdl
(4.81 KiB) Downloaded 555 times
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post 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.
xhoward
Junior Member
Posts: 12
Joined: Thu Apr 27, 2006 7:03 am

Post 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
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

lookup

Post 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
Attachments
RandomLookup_bis.mdl
(6.83 KiB) Downloaded 538 times
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

lookup

Post 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
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post 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.
tangent
Member
Posts: 22
Joined: Wed Jun 25, 2008 7:07 am

Post 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]
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Random lookup

Post 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
tangent
Member
Posts: 22
Joined: Wed Jun 25, 2008 7:07 am

Post by tangent »

Model attached
Attachments
DelayRandom.mdl
(3.1 KiB) Downloaded 354 times
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post 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.
tangent
Member
Posts: 22
Joined: Wed Jun 25, 2008 7:07 am

Post 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]
Attachments
DelayRandom.mdl
(3.3 KiB) Downloaded 323 times
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post 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.
tangent
Member
Posts: 22
Joined: Wed Jun 25, 2008 7:07 am

Post 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
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post 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.
Post Reply