[R] Counting things

Noah Silverman noah at smartmediacorp.com
Wed Aug 5 05:40:15 CEST 2009


I've completed an experiment and want to summarize the results.

There are two things I like to create.

1) A simple count of things from the data.frame with predictions
     1a) Number of predictions with probability greater than x
     1b) Number of predictions with probability greater than x that are 
really true

     In SQL, this would be,
         "Select count(predictions) from data.frame where probability > x"
"Select count(predictions) from data.frame where probability > x and 
label ='T' "

How can I do this one in R?


2) I'd like to create what we call "binning".  It is a simple list of 
probability ranges and how accurate our model is.  The idea is to see 
how "true" our probabilities are.
for example

range        number of items        mean(probability)   true_accuracy
100-90%        20                            .924                    .90
90-80%          50                            .825                    .84
80-70%          214                          .75                      .71
etc...

It would be really great if I could also graph this!

Is there any kind of package or way to do this in R

Thanks!

-N




More information about the R-help mailing list