confusion matrix

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

confusion matrix

Doussa
hi users
I have a data frame in with there are two colomns real values and predicted ones (for a dichotomic response).
How can i obtain a confusion matrix (miscalssification rat and errors)?
The costs are egal.

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: confusion matrix

Adams, Jean
Try the table() function.

?table

For example,

df <- data.frame(real=sample(0:1, 20, replace=T), pred=sample(0:1, 20,
replace=T))
table(df)

    pred
real 0 1
   0 3 7
   1 4 6

Jean


Doussa wrote on 09/02/2011 08:46:42 PM:
>
> hi users
> I have a data frame in with there are two colomns real values and
predicted
> ones (for a dichotomic response).
> How can i obtain a confusion matrix (miscalssification rat and errors)?
> The costs are egal.
>
> Thanks

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.