[R] ROC curve using epicalc (after logistic regression)

Clifford Long gnolffilc at gmail.com
Sun Jul 26 22:52:54 CEST 2009


Dear R-help list,

I'm attempting to use the ROC routine from the epicalc package after
performing a logistic regression analysis.  My code is included after
the sessionInfo() result.  The datafile (GasketMelt1.csv) is attached.
 I updated both R and the epicalc packages and tried again before
sending this request.

sessionInfo result:

R version 2.9.1 (2009-06-26)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] splines   stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
[1] caret_4.19      lattice_0.17-25 epicalc_2.9.1.2 survival_2.35-4
[5] foreign_0.8-36

loaded via a namespace (and not attached):
[1] grid_2.9.1  tools_2.9.1


Header information from package 'epicalc':
Package:            epicalc
Version:            2.9.1.2
Date:               2009-07-14


My code ...

#------------------------------------------------
#  Logistic Regression   (the model result is as expected)
#------------------------------------------------

dfile = 'GasketMelt1.csv'
gmelt.df = read.csv(dfile, header = TRUE, as.is = TRUE)
names(gmelt.df)

gmelt.df$p = gmelt.df$Pass / gmelt.df$Total

gmelt.glm = glm(p ~ Time + Temperature + Depth
			+ Time*Temperature + Time*Depth + Temperature*Depth,
			family = binomial(link = logit), data=gmelt.df, weight=Total)
summary(gmelt.glm)

#------------------------------------------------
#  ROC
#------------------------------------------------
library(epicalc)

lroc(gmelt.glm, graph = TRUE, line.col = "red")


The error message:

> lroc(gmelt.glm, graph = TRUE, line.col = "red")
Error in dimnames(x) <- dn :
  length of 'dimnames' [2] not equal to array extent



Have I overlooked something?


Many thanks to anyone who might have a suggestion.

Cliff


More information about the R-help mailing list