Dear Eviews team
'==========================='
'CALCUTLATING FORECAST ERROR, ITS VARIANCE, and generating RANDOM DRAWS
'==============================
genr error_CA_{%h}Y_{%c}_AR = CA_{%c}  CA_{%c}_0_AR 'actualforecast = error
scalar errorvariance_CA_{%h}Y_{%c}_AR=@var( error_CA_{%h}Y_{%c}_AR) 'Forecast error variance
scalar num_draws_AR = 1000 'Set the number of random draws you want to generate random draws from the normal distribution
series draws_errorvariance_CA_{%h}Y_{%c}_AR=@rnorm(num_draws, 0, @sqrt(errorvariance_CA_{%h}Y_{%c}_AR)) ' generate random draws from
the normal distribution //
ON THE LAST LINE OF THIS CODE I KEEP GETTING A SYNTAX ERROR. I cannot figure out why. Please advice.
Kind Regards,
Florence
GENERATING RANDOM NORMAL DRAWS
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 13286
 Joined: Tue Sep 16, 2008 5:38 pm
Re: GENERATING RANDOM NORMAL DRAWS
Without the rest of the code and/or workfile impossible to say. But you probably need to have had defined num_draws
Follow us on Twitter @IHSEViews

 EViews Developer
 Posts: 557
 Joined: Thu Apr 25, 2013 7:48 pm
Re: GENERATING RANDOM NORMAL DRAWS
Quick follow up... EViews' @rnorm function is parameterless since it returns draws from the standard normal distribution. You can adjust your genr statement accordingly, e.g.,
Code: Select all
series draws_errorvariance_CA_{%h}Y_{%c}_AR = @rnorm * @sqrt(errorvariance_CA_{%h}Y_{%c}_AR)
Re: GENERATING RANDOM NORMAL DRAWS
EViews Matt wrote:Quick follow up... EViews' @rnorm function is parameterless since it returns draws from the standard normal distribution. You can adjust your genr statement accordingly, e.g.,Code: Select all
series draws_errorvariance_CA_{%h}Y_{%c}_AR = @rnorm * @sqrt(errorvariance_CA_{%h}Y_{%c}_AR)
Thank you for the responses.
The problem with @rnorm syntax does not allow multiple random draws, e.g 1000
@rmvnorm works well for a VAR model. I can generate 1000 random draws.
matrix draw_var_{%c}=@rmvnorm(covs_{%c}, 1000) 'random draws from the normal distribution
How can I draw these 1000 draws using a simple AR model? I have tried @rnorm and @nrnd
Re: GENERATING RANDOM NORMAL DRAWS
Greetings,
Problem solved. After the @rnorm code you suggested, I simply created a new page with 1000 random observations, then wala!
Again thank you for your help. Much appreciated.
Problem solved. After the @rnorm code you suggested, I simply created a new page with 1000 random observations, then wala!
Again thank you for your help. Much appreciated.
Who is online
Users browsing this forum: No registered users and 3 guests