number of positive obs and runs in series

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

number of positive obs and runs in series

Postby ch2324 » Fri Feb 19, 2016 7:53 am

Hi everybody,
how can calculate number of positive obs in the series?
when i use this command message error "syntax error"

Code: Select all

scalar nobsp
nobsp=@obs(resid) if resid>0

have you an idea with this case.
Last edited by ch2324 on Fri Feb 19, 2016 8:10 am, edited 3 times in total.

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

Re: number of positive obs in series

Postby startz » Fri Feb 19, 2016 8:06 am

Code: Select all

series posSum = @sum(resid>0)

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

Re: number of positive obs and runs in series

Postby ch2324 » Fri Feb 19, 2016 8:13 am

thanks Mr startz, another question please, how get the number of positive obs in the scalar? an error message "Scalar sent to function which operates on a matrix." and how can calculate the number of runs in the resid?

Code: Select all

scalar nobsp
nobop=@sum(resid>0)

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

Re: number of positive obs and runs in series

Postby startz » Fri Feb 19, 2016 8:54 am

No idea. Sorry.

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

Re: number of positive obs and runs in series

Postby EViews Gareth » Fri Feb 19, 2016 9:29 am

What's the definition of a "run"?

If it is simply any time resid switches from negative to positive or vice versa...

Code: Select all

series posres = resid>0
series runs = @recode(@trend=0, 1, (resid>0 and resid(-1)>0) or (resid<0 and resid(-1)>0))

scalar nobsp = @sum(posres)
scalar nobsr = @sum(runs)
Follow us on Twitter @IHSEViews

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

Re: number of positive obs and runs in series

Postby ch2324 » Fri Feb 19, 2016 1:00 pm

a tiny mistake :oops: the correct code is:

Code: Select all

series runs = @recode(@trend=0, 1, (resid>0 and resid(-1)<0) or (resid<0 and resid(-1)>0))

thanks million Mr Gareth & Mr startz for your help :D


Return to “General Information and Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 18 guests