calculating mean

For questions regarding programming in the EViews programming language.

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

tony
Posts: 59
Joined: Wed Jan 07, 2009 7:59 am

calculating mean

Postby tony » Tue Feb 28, 2017 7:24 am

Hi, there
surppose there is a variable, cigs, which show the number of one somke per day, 0 means no smoking. And I want to calculate the mean of
those take cigarrets. How to do that?

Thank you, all

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

Re: calculating mean

Postby startz » Tue Feb 28, 2017 8:23 am

Look at the help system for @mean

tony
Posts: 59
Joined: Wed Jan 07, 2009 7:59 am

Re: calculating mean

Postby tony » Thu Mar 02, 2017 6:25 am

startz wrote:Look at the help system for @mean

I read the help, but I have no idea about this, could you show me the right way.
Thank you.

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

Re: calculating mean

Postby startz » Thu Mar 02, 2017 6:55 am

series y =@mean(cigs)

tony
Posts: 59
Joined: Wed Jan 07, 2009 7:59 am

Re: calculating mean

Postby tony » Sat Mar 04, 2017 8:56 pm

No, I mean y=@mean(cigs, in which cigs not equal to 0).
Say there are 50 observations in which 30 observations equal 0.
I just want to calculate the mean of the rest 20, and how to do this using a command function.
Thank you.

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

Re: calculating mean

Postby startz » Sat Mar 04, 2017 9:00 pm

smpl if cigs>0
series y=@mean(cigs)

or set the smpl and then open cigs and view stats

tony
Posts: 59
Joined: Wed Jan 07, 2009 7:59 am

Re: calculating mean

Postby tony » Sat Mar 04, 2017 10:26 pm

Thanks a lot!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 25 guests