Page 1 of 1

Counting elem. of a group or matrix with a certain condition

Posted: Wed Aug 25, 2010 9:17 am
by jfgeli
Hi, I have a group of time series of public debt. My workfile goes from 1990.1 to 2016.4. The sample is from 1990.1 to 2009.4. In the group, I have 101 series. In the sample, the 101 series have the same values but from 2010.1 to 2016.4 are different because they are forecasts. In concrete, I have 101 different projections. Each projection is associated with an empirical distribution function are related to 0.001%, 1%....,99% and 99.9999% likelihood of ocurrence. For each period in the forecasted horizon, i need to say which is the empirical "probability" of being x times (where x could be 1.1 or 1.5). For this, I thought of counting how many elements of the row of the group associated with 2010.1 satisfy the condition of being x times the mean of the elements of the row associated to 2009.4 (which are actually all the same).

Here is my problem, how can I count the number of elements which satisfy a certain condition? I thought of converting the group into a matrix, but the problem is the same because I do not know if there is a command to count the elements of a row of a matrix which satisfy a certain condition.

Thanks in advance for the help.

Re: Counting elem. of a group or matrix with a certain condition

Posted: Wed Aug 25, 2010 9:35 am
by EViews Gareth
You could use the @egt or @elt (or other similar functions) to create a matrix of 1s and 0s depending on whether your condition is met. Then you just have to sum up the rows of that matrix as your count.