Bug in @elem?

For notifying us of what you believe are bugs or errors in EViews.
Please ensure your copy of EViews is up-to-date before posting.

Moderators: EViews Gareth, EViews Moderator

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Bug in @elem?

Postby startz » Wed May 18, 2011 1:27 pm

Is this a bug in @elem, or just a misunderstanding on my part.

Code: Select all

series studentToShow = @ceiling(@obsrange*rnd)
scalar student = @elem(studentToShow,1)

I get the error message
Capture.PNG
Capture.PNG (15.73 KiB) Viewed 4510 times


This is running in an undated workfile.

For what it's worth, all I really want to do is to randomly select one observation from an alpha series in the next step. Maybe there's a better way to do it?

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

Re: Bug in @elem?

Postby EViews Gareth » Wed May 18, 2011 1:54 pm

Not a bug. @elem requires that the second argument be in quotes.

Of course a better way would just be:

Code: Select all

scalar student = @floor(@runif(1,@obsrange))
Follow us on Twitter @IHSEViews

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Bug in @elem?

Postby startz » Wed May 18, 2011 1:58 pm

(a) Thank you.
(b) You're right.
(c) It's not my fault. The documentation reads

@elem takes two arguments: the first argument is the name of the series, and the second is the date or observation identifier.

For example, suppose that you want to use the 1980Q3 value of the quarterly series Y, or observation 323 of the undated series X. Then the functions:

@elem(y, 1980Q3)

@elem(x, 323)

will return the values of the respective series in the respective periods.

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

Re: Bug in @elem?

Postby EViews Gareth » Wed May 18, 2011 2:06 pm

Yep, I've noticed that before.
Follow us on Twitter @IHSEViews

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Bug in @elem?

Postby startz » Wed May 18, 2011 2:06 pm

Also, are you sure about @floor rather than @ceiling? Or put better, if I want the closed interval [1,@obsrange] do I need

Code: Select all

 @floor(@runif(1,@obsrange+1))
?

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

Re: Bug in @elem?

Postby EViews Gareth » Wed May 18, 2011 2:10 pm

As soon as I posted the code, I thought to myself I wonder if I should change it to add the +1, or should I wait and see if he notices it.
Follow us on Twitter @IHSEViews


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 16 guests