[R] Probability of exceedance function question

Thomas P. Colson tpcolson at ncsu.edu
Sun Oct 8 20:57:34 CEST 2006


I'm trying to calculate a cumulative area distribution (graph) of drainage
areas. This is defined as P(A > A*). Simple in principle. I can do this in
excel, with "COUNTIF", which will count the number of cells in the row
"area" that have area A, then determine, for each cell in the row "area, how
many cells exceede that area, then dividing that number by the total number
of cells, which gives me the probability that drainage area A exceeds
drainage area A*. 

E.g, drainage area of 6 sq meters (One DEM grid cell) has a high probability
of exceedance(.99), while a drainage area of 100,000 square meters has a low
probability of exceedance (.001). 

I wish to plot this relationship, and we all know that excel is not the tool
of choice when working with hundreds of thousands of records. I'd like to
port the CAD into a few R functions that I've already developed for other
tests as well.  

So my challenge, in R, is to 
(1)count the number of rows in column "Area" that have AREA(*), 

(2) determine, by row, how many rows have an area greater than the area
given in that one row 

(3) divide step 2 by number of rows (how can I do a row count and port that
to a variable, as I have to do this on 10 datasets?)

Thanks for any advice you can offer to this endevour



More information about the R-help mailing list