Sally Ann Sims
2011-Dec-12 21:31 UTC
[R] Formatting probability data to produce confusion matrix for binary data for logistric regression
Hello R folks,
I’m looking to produce a confusion matrix using the command:
cmx(PData,threshold=0.49,na.rm=FALSE) for a logistic regression model (1 is
habitat, 0 is nonhabitat).
To compile my PData data file (csv file) (as in the example above), I’m using
the output of the predict(glm) function. Is there a way to export the output of
the predict function (which formats itself as shown below) so that I can export
it into Excel as two columns (i.e., sample ID and probability?). At present,
when I try copy and paste, it ends up in one cell and is not easily manipulated.
R output format example:
1 2 3 4 5
6 7 8 9 10 11
12
0.526278645 0.989458044 0.834739251 -1.207218093 0.957373344
0.988643146 -0.356652329 0.889463121 0.858587923 0.270430050
1.000781325 0.999526931
13 14 15 16 17
18 19 20 21 22 23
24
0.991809010 0.751469061 -0.740746896 0.249451379 0.992102707
0.528213419 0.336177573 -0.944476861 1.000292603 0.273345885
0.994184267 -1.419114223
Or is there another function for entering probabilities into my data file to
calculate a confusion matrix?
Thank you,
Sally
[[alternative HTML version deleted]]
