Hello everyone,
I am new to Vensim, and apologize if this is and easy question or has been answered previously. I searched the forum, and could not find my answer.
Please Suppose that we have a time series defined as:
P_t=a+b*P_t-1 (AR1)
Can any one please sketch, or let me know how to input this into vensim?
Thanks
Mehdi
How to input a time series function
-
- Member
- Posts: 20
- Joined: Wed Mar 07, 2012 10:50 pm
- Vensim version: DSS
Re: How to input a time series function
Hi Mehdi,
Please check the attached file. It calculates P(t)=a+b*P(t-1), where t is Time. Is that what you were looking for?
Please feel free to ask me if you need some explanation.
Best,
M.J.
Please check the attached file. It calculates P(t)=a+b*P(t-1), where t is Time. Is that what you were looking for?
Please feel free to ask me if you need some explanation.
Best,
M.J.
- Attachments
-
- Example.mdl
- (1.61 KiB) Downloaded 262 times
Re: How to input a time series function
Hello Mohammad,
Thanks for the response. The equation is what I want, and p in your model has the required property. However, I actually need to define it in terms of an autoregressive or AR(1) process. Meaning P(t)=a(t) + b*P(t-1). Where a(t) is sequence of random numbers. I have attached my understanding to this. However, my model does not run. The food price is the required time series, and you can see that the equation is a bit more complicated than the one we are discussing here. Thank for your response.
Mehdi
Thanks for the response. The equation is what I want, and p in your model has the required property. However, I actually need to define it in terms of an autoregressive or AR(1) process. Meaning P(t)=a(t) + b*P(t-1). Where a(t) is sequence of random numbers. I have attached my understanding to this. However, my model does not run. The food price is the required time series, and you can see that the equation is a bit more complicated than the one we are discussing here. Thank for your response.
Mehdi
- Attachments
-
- sample model.mdl
- (2.65 KiB) Downloaded 237 times
-
- Member
- Posts: 20
- Joined: Wed Mar 07, 2012 10:50 pm
- Vensim version: DSS
Re: How to input a time series function
If you go to Model > Check Model, you can see what the problem is that your model cannot be run. The "Food price equal" is used as, but not defined as, a lookup. It is defined as an Auxiliary.
And in autoregressive or AR(1), a(t) is random with zero mean and variance of sigma squared, so you can simply generate a random Normal number in Vensim with the respective mean and variance.
The function to generate a random Normal number is: RANDOM NORMAL( {min} , {max} , {mean} , {stdev} , {seed} ) but if you don't know min and max values, you may use the form of six sigma range that is ({mean} + {stdev} * RANDOM NORMAL(-6,6,0,1,{seed})).
M.J.
And in autoregressive or AR(1), a(t) is random with zero mean and variance of sigma squared, so you can simply generate a random Normal number in Vensim with the respective mean and variance.
The function to generate a random Normal number is: RANDOM NORMAL( {min} , {max} , {mean} , {stdev} , {seed} ) but if you don't know min and max values, you may use the form of six sigma range that is ({mean} + {stdev} * RANDOM NORMAL(-6,6,0,1,{seed})).
M.J.