Monte Carlo
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
Monte Carlo
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
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
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13318
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Monte Carlo
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
Follow us on Twitter @IHSEViews
Re: Monte Carlo
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 !
"smpl @first @first" and "smpl @first+1 @last" are delimiters
To set the first element to 5, I could also have written
Code: Select all
smpl @first @first
series y = 5
This looks pretty easy indeed
Thanks !
Re: Monte Carlo
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?
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?
-
- Non-normality and collinearity are NOT problems!
- Posts: 3775
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Monte Carlo
Code: Select all
2+sqr(3)*nrnd
Re: Monte Carlo
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!
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!
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13318
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Monte Carlo
The @rlogistic function creates random variables from the logistic distribution.
Follow us on Twitter @IHSEViews
Re: Monte Carlo
EViews Gareth wrote: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?
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13318
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Monte Carlo
To generate a series with mean X and scale parameter Y, you would do:
Code: Select all
series z = x + y*@rlogistic
Follow us on Twitter @IHSEViews
-
- Non-normality and collinearity are NOT problems!
- Posts: 3775
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Monte Carlo
EViews Gareth wrote:To generate a series with mean X and scale parameter Y, you would do:Code: Select all
series z = x + y*@rlogistic
Actually, not quite. The standard deviation of the logistic isn't 1.0. So the scale doesn't give you the standard deviation.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13318
- Joined: Tue Sep 16, 2008 5:38 pm
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13318
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Monte Carlo
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
Follow us on Twitter @IHSEViews
Who is online
Users browsing this forum: No registered users and 53 guests