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

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

jfgeli
Posts: 72
Joined: Fri Jan 30, 2009 6:29 pm

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

Postby jfgeli » Wed Aug 25, 2010 9:17 am

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.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13603
Joined: Tue Sep 16, 2008 5:38 pm

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

Postby EViews Gareth » Wed Aug 25, 2010 9:35 am

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.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests