Page 1 of 1
Monte Carlo
Posted: Mon Apr 12, 2010 1:29 pm
by jimmy1899
Hello,
I have had a look at the Monte Carlo examples. I think I will store the simulation results into a matrix.
However I would have liked to learn how to program some kind of recursive algorithm with EViews.
What's a good way to program such a model : Y(t) = a*Y(t-1)+b+nrnd ?
Thanks for you help !
Jimmy
Re: Monte Carlo
Posted: Mon Apr 12, 2010 1:40 pm
by EViews Gareth
You'll need to seed Y_1 at some value, after that it is relatively simple:
Code: Select all
'seed Y_1
smpl @first @first
series y = nrnd
'calculate the rest of the values
smpl @first+1 @last
y = a*y(-1) + b + nrnd
Re: Monte Carlo
Posted: Mon Apr 12, 2010 3:00 pm
by jimmy1899
Thank you very much Gareth
"smpl @first @first" and "smpl @first+1 @last" are delimiters
To set the first element to 5, I could also have written
This looks pretty easy indeed
Thanks !
Re: Monte Carlo
Posted: Fri Mar 22, 2013 3:13 am
by kzmh78
Hello,
When monte carlo program generate a sequence of random numbers,
almost of examples had used a Nornal disitrubution,mean is 0, and variance is 1(using command @rnorm or nrnd).
However, I want to use a nornal disitrubution,mean is 2, and variance is 3.
Does EViews have any commands?
Re: Monte Carlo
Posted: Fri Mar 22, 2013 6:48 am
by startz
Re: Monte Carlo
Posted: Thu Apr 11, 2013 12:54 pm
by mvilla29
Hi
I'm triyin to generate a random number serie, distribited logistic with mean 85.22 and Standard Deviation 18.44, with 260 observations but I don“t know how to do this. I want to to do a Montecarlo experiment with 10.000 iteration like this but I don't know how to do this. Can you help me, please?
Thks!
Re: Monte Carlo
Posted: Thu Apr 11, 2013 1:07 pm
by EViews Gareth
The @rlogistic function creates random variables from the logistic distribution.
Re: Monte Carlo
Posted: Thu Apr 11, 2013 1:50 pm
by mvilla29
The @rlogistic function creates random variables from the logistic distribution.
Ok, but, how can i asign a mean of 85.22 and a standard deviation of 18.4?
Re: Monte Carlo
Posted: Thu Apr 11, 2013 2:12 pm
by EViews Gareth
To generate a series with mean X and
scale parameter Y, you would do:
Re: Monte Carlo
Posted: Thu Apr 11, 2013 2:17 pm
by mvilla29
Thank you Gareth!!
Re: Monte Carlo
Posted: Thu Apr 11, 2013 2:56 pm
by startz
To generate a series with mean X and
scale parameter Y, you would do:
Actually, not quite. The standard deviation of the logistic isn't 1.0. So the scale doesn't give you the standard deviation.
Re: Monte Carlo
Posted: Thu Apr 11, 2013 2:58 pm
by EViews Gareth
I didn't say anything about std dev.

Re: Monte Carlo
Posted: Thu Apr 11, 2013 3:05 pm
by EViews Gareth
A quick bit of Google-fu indicates that to get a mean of m and standard deviation of s, you'd do:
Code: Select all
series y = m + s*@sqrt(3/(16*@atan(1)^2))*@rlogistic