I have a number of calculated series with data that either is present or isn't ("NA").
I'm looking for a formula that will produce an average of the available data:
Field Value
Cat 2
Dog 4
Bird NA
Average = 3...
Easy stuff, but I'm stuck.
Help greatly appreciated...
Average, Ignoring "NA"
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Average, Ignoring "NA"
View->Descriptive Statistics.
Re: Average, Ignoring "NA"
Thanks, Gareth... Very cool...
But that's not what I mean...
I have ten calculated fields that assume values of either 1, 0.5, 0, or NA based on other fields' values... I need to find the average of the ten fields for the month of April.
If data is not available yet for one of the series that produce the values 1, 0.5, or 0, the value in the calculated field comes back as "NA". When "NAs" are present, I can't calculate the average of the individual calculated fields.
I know it may not be the best practice, but I really want that average to be calculated based on whatever number of values are available. I don't want the "NA" to prevent the average from being calculated.
...
But that's not what I mean...
I have ten calculated fields that assume values of either 1, 0.5, 0, or NA based on other fields' values... I need to find the average of the ten fields for the month of April.
If data is not available yet for one of the series that produce the values 1, 0.5, or 0, the value in the calculated field comes back as "NA". When "NAs" are present, I can't calculate the average of the individual calculated fields.
I know it may not be the best practice, but I really want that average to be calculated based on whatever number of values are available. I don't want the "NA" to prevent the average from being calculated.
...
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Average, Ignoring "NA"
You'll need to be more precise on what you are doing. The descriptive statistics of a series ignore NAs and will not pass them on, by default.
Re: Average, Ignoring "NA"
I have three different calculated series. Two of them have numbers in them. One has a NA value.
I've got another series that calculates the average of the first three. If there is an NA value, my average doesn't work.
I'm just looking for a formula that will take the average of the two available numbers and ignore the NA.
I've got another series that calculates the average of the first three. If there is an NA value, my average doesn't work.
I'm just looking for a formula that will take the average of the two available numbers and ignore the NA.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Average, Ignoring "NA"
Still fairly vague...
It sounds like you are trying to calculate the mean of three series on an observation by observation basis. The way to do this in EViews is to put the three series in a group, then use the @rmean function. I assume that's what you're doing. But the @rmean function (like nearly all other functions) ignores NAs, so I don't know what the issue is.
It sounds like you are trying to calculate the mean of three series on an observation by observation basis. The way to do this in EViews is to put the three series in a group, then use the @rmean function. I assume that's what you're doing. But the @rmean function (like nearly all other functions) ignores NAs, so I don't know what the issue is.
Code: Select all
create u 100
series x=1
series y=2
series z=3
smpl 2 2
z = na
smpl 5 5
z=na
smpl @all
group g x y z
series mymean = @rmean(g)
show mymean
Re: Average, Ignoring "NA"
Yes. That's it. I didn't know about group row functions.
Now I do.
Thank you.
Now I do.
Thank you.
Who is online
Users browsing this forum: No registered users and 2 guests
