Calculating mean minus index observation

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

ww34
Posts: 7
Joined: Tue May 06, 2014 6:59 am

Calculating mean minus index observation

Postby ww34 » Tue May 06, 2014 7:04 am

I am trying to calculate mean preschool enrolment in each class, excluding the index child. I am using the command

series meanenrol= @meansby(preschool, t2_id, "@all")

t2_id is the teacher id which identifies the class and this is working fine to give me the average for the class but I want the average for the class excluding the observation child. Does anybody have any idea how I can do this? Thanks in advance.

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

Re: Calculating mean minus index observation

Postby startz » Tue May 06, 2014 7:17 am

Code: Select all

series meanenrol= @meansby(preschool, t2_id, "@all") - preschool

ww34
Posts: 7
Joined: Tue May 06, 2014 6:59 am

Re: Calculating mean minus index observation

Postby ww34 » Tue May 06, 2014 7:30 am

Thanks but that didn't work, gave me negative numbers. If it helps preschool is a dummy variable.

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

Re: Calculating mean minus index observation

Postby startz » Tue May 06, 2014 7:56 am

Oops, I misunderstood what you want. Maybe something like

Code: Select all

series meanenrol= (@sumsby(preschool, t2_id, "@all")-preschool)/(@obsby(preschool, t2_id, "@all")-1)

ww34
Posts: 7
Joined: Tue May 06, 2014 6:59 am

Re: Calculating mean minus index observation

Postby ww34 » Tue May 06, 2014 8:01 am

Brilliant! That worked perfectly. Thank you so much!


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests