Page 1 of 1

Calculating and assigning percentiles as values

Posted: Wed Sep 04, 2013 1:19 pm
by RPEDC
I'm working on a program where I have a number of countries and a number of variables. For some variables for some countries the data is missing or unreported.

What I'd like to do (and am not sure how to program in Eviews) would be to include in the program coding is language that does the following :

-For countries with data available for variable X calculate the value of X for the 10th, 40th, 60th and 90th percentile
-Then based on a previously developed category scale, for countries where data for variable X is missing, assign one of the percentile variables in it place.

For example:
Zim = Category 1 (so want to assign the 10th percentile) value for variable X calculated from all other countries who have data present for variable X.


Thanks for any help on this.

Re: Calculating and assigning percentiles as values

Posted: Mon Sep 09, 2013 6:34 am
by RPEDC
Since there hasn't been a reply, I'm wondering if I could break this down a bit:

-Are there any commands in programming that allow you to calculate percetile values within a group?

Re: Calculating and assigning percentiles as values

Posted: Mon Sep 09, 2013 8:09 am
by EViews Glenn
For percentiles by subgroup, try @quantilesby.

Re: Calculating and assigning percentiles as values

Posted: Mon Sep 09, 2013 8:44 am
by RPEDC
For percentiles by subgroup, try @quantilesby.
Thanks for the suggestion!

I've never used that coding before, so how would I set up the arguments? Reading the help file I think it would be something like below, is that correct? Is it possible to name the @quantilesby result?

Code: Select all

@quantilesby(GDP,Group_A, 0.1)

Re: Calculating and assigning percentiles as values

Posted: Thu Sep 26, 2013 4:19 pm
by RPEDC
I'm wondering if anyone can confirm for the the proper arguments to include in the @quantilesby command.

If I want to calculate the 10th percentile for the GDP variable of a group of countries should the command language be:

Code: Select all

@quantilesby(GDP,Group_A, 0.1)

Re: Calculating and assigning percentiles as values

Posted: Fri Sep 27, 2013 11:35 am
by EViews Glenn
Looks fine.

Re: Calculating and assigning percentiles as values

Posted: Wed Oct 02, 2013 6:41 am
by RPEDC
Thanks for that. My issues is that I'm still having trouble programming to get the result. I'm getting errors about the arguments used. Maybe I'll re-explain how I've got the file set up in case I've done something wrong.

As an example of the data I have, I've uploaded this file (
Test.xlsx
This is how the data is set up in the workfile.
(8.96 KiB) Downloaded 335 times
).


In reality I've got data for about 150 countries that I'm looking at.

What I want to figure out how to program is to take the individual GDP series and then after adding them into a group, is to program the way to calculate the percentiles for given years. So, looking at the example file say I want to add the series into a group (X) and then find the 80th percentile for that group. When I've tried doing this using the @quantilesby command I'm getting errors and not the result I'm looking for.

If the way I'm looking to do this isn't possible, what might be a better approach?