Hi everyone,
Could you please help me solve this puzzle? I have a time series A filled with observations and a series B filled with observations for the same time frame. Is there a way to find a mean of values of series B corresponding to every decile of series A?
As an example, you can imagine a time series A filled with 1000 observations ranging from 1 to 10 and a series B of 1000 observations. I would like to take the last decile (from 9 to 10) of series A and calculate a mean of the corresponding observations from series B.
Mean of values of the series for decile of another series
Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator
-
- EViews Developer
- Posts: 560
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Mean of values of the series for decile of another series
Hello,
As an example, the following creates scalars mean1, mean2, ..., mean10 for the means of b matching the observations spanning the deciles of a.
As an example, the following creates scalars mean1, mean2, ..., mean10 for the means of b matching the observations spanning the deciles of a.
Code: Select all
for !i = 1 to 10
smpl if @ceil(@pctiles(a) / 10) = !i
scalar mean!i = @mean(b)
next
Re: Mean of values of the series for decile of another series
Hi Matt,
Thank you for your help! Logically it is a great solution even though I needed to use @100 * @ranks(a, “a”, ties) / @obs(a) instead of @pctiles(a) in order to get it to work for my setup.
Thank you for your help! Logically it is a great solution even though I needed to use @100 * @ranks(a, “a”, ties) / @obs(a) instead of @pctiles(a) in order to get it to work for my setup.
EViews Matt wrote:Hello,
As an example, the following creates scalars mean1, mean2, ..., mean10 for the means of b matching the observations spanning the deciles of a.Code: Select all
for !i = 1 to 10
smpl if @ceil(@pctiles(a) / 10) = !i
scalar mean!i = @mean(b)
next
-
- EViews Developer
- Posts: 560
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Mean of values of the series for decile of another series
Ah, you're using EViews 10 or earlier. No problem.
Who is online
Users browsing this forum: No registered users and 22 guests