Re: [R] Is there a function for this?

From: Andreas Hary <andreashary_at_googlemail.com>
Date: Wed 03 Jan 2007 - 15:30:45 GMT

Try the following:

act <- c('good','good','bad','bad','good','good','bad','bad') pred <- c('good','bad','bad','bad','good','good','good','bad') table(pred,act)
table(pred,act)/apply(table(pred,act),1,sum)

Cheers,

Andreas

On 1/3/07, Feng Qiu <hustqiufeng@sohu.com> wrote:
> Hi everybody, I'm trying to do a statistic on the error rate of a prediction
> algorithm.

>
> suppose this is the real category
> [good, good, bad, bad, good, good, bad, bad]
> this is the predicted category
> [good, bad, bad, bad, good, good, good, bad]

>
> I'm trying to do a statistic on the error rate for each group("good","bad"):
> what percentage of instances are predicted incorrectly for each group ?
> Of course I can write a loop to do that, but is there a easy way to do that?

>
> Thank you!
>
> Best,
>
> Feng
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu Jan 04 08:52:35 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 03 Jan 2007 - 22:30:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.