Clifford Long
2009-Jul-27 05:59 UTC
[R] ROC curve using epicalc (after logistic regression) (re-sent)
Dear R-help, I am resending as I believe I screwed up the e-mail address to R-help earlier. Sorry for my lack of attention to detail, and for any inconvenience. I have also sent the question to the package maintainer, as suggested in the posting guide. Regards, Cliff ---------- Forwarded message ---------- From: Clifford Long <gnolffilc at gmail.com> Date: Sun, Jul 26, 2009 at 8:46 PM Subject: Fwd: ROC curve using epicalc (after logistic regression) To: cvirasak at medicine.psu.ac.th Dear Virasakdi Chongsuvivatwong, After sending the message below to the R-help mailing list, it occurred to me that I probably should also have sent a copy to you, per R posting guidance. I would be interested in any thoughts or suggestions that you might have regarding my difficulty using the ROCR routine in the epicalc package. ?(I've used this before, and find it to be a very helpful package ... thanks.) Is my issue related to the way the data is structured for the glm routine - meaning not with individual cases, but instead by counts (per DOE treatment) of pass, fail, and total? Or perhaps I've made another error? I'll understand if you don't have the time to look this over. ?In case you do, any direction/guidance will be appreciated. Thank you for your time, and for this excellent package. Regards, Cliff Long ---------- Forwarded message ---------- From: Clifford Long <gnolffilc at gmail.com> Date: Sun, Jul 26, 2009 at 3:52 PM Subject: ROC curve using epicalc (after logistic regression) To: R-help at r-project.org 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