generate a vector of random values

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

elmst616
Posts: 32
Joined: Fri Apr 29, 2016 2:36 pm

generate a vector of random values

Postby elmst616 » Sat May 21, 2016 4:29 pm

Hi I'd like to generate a vector of random values.

I have been trying vector(15) myvec = 0.5*nrnd

but I get the error message
Syntax error in "VECTOR(15) myvec = 0.5*NRND".

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12648
Joined: Tue Sep 16, 2008 5:38 pm

Re: generate a vector of random values

Postby EViews Gareth » Sat May 21, 2016 11:59 pm

Try @rnorm
Follow us on Twitter @IHSEViews

EViews Glenn
EViews Developer
Posts: 2646
Joined: Wed Oct 15, 2008 9:17 am

Re: generate a vector of random values

Postby EViews Glenn » Tue May 24, 2016 10:06 am

@rnorm works best for element assignment. To fill the entire vector in one go, use

Code: Select all

nrnd(vec)

as in

Code: Select all

vector(10) a
nrnd(a)

elmst616
Posts: 32
Joined: Fri Apr 29, 2016 2:36 pm

Re: generate a vector of random values

Postby elmst616 » Wed May 25, 2016 10:59 am

EViews Glenn wrote:@rnorm works best for element assignment. To fill the entire vector in one go, use

Code: Select all

nrnd(vec)

as in

Code: Select all

vector(10) a
nrnd(a)



Thank you this is very efficient in my program!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 30 guests