## How to input a time series function

Use this forum to post Vensim related questions.

### How to input a time series function

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
mehdi2
Junior Member

Posts: 2
Joined: Sun Apr 01, 2012 9:49 pm

### 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?

Best,
M.J.
Attachments
Example.mdl
Junior Member

Posts: 19
Joined: Wed Mar 07, 2012 10:50 pm
Location: Washington, DC

### Re: How to input a time series function

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
mehdi2
Junior Member

Posts: 2
Joined: Sun Apr 01, 2012 9:49 pm

### 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.