Re: [R] plotting several ROC curves on the same graph

2011-03-29 Thread meytar
Thank you very much

I'll try this 

Meytar

 

From: Brian Diggs [via R]
[mailto:ml-node+3415433-1829104127-202...@n4.nabble.com] 
Sent: Tuesday, March 29, 2011 6:46 PM
To: meytar
Subject: Re: plotting several ROC curves on the same graph

 

On 3/29/2011 2:48 AM, meytar wrote: 


> Hello 
> I am trying to make a graph of 10 different lines built each from 4 
> different 
> segments and to add a darker line that will represent the average of all 
> graphs 
> - all in the same plot.Actually each line is a ROC plot 
> The code I'm using for plotting one line is as follows: 
> 
> logit.roc.plot<- function(r, title="ROC curve") { 
> old.par<- par(no.readonly = TRUE); on.exit(par(old.par)) 
> par(xaxs="i", yaxs="i") 
> plot(1 - r$spec, r$sens, xlim=c(0, 1), ylim=c(0,1), type="l", 
> xlab="(1 - specificity): false positive rate", 
> ylab="sensitivity: true positive rate", 
> col="grey82", lwd=2); 
> points(1 - r$spec, r$sens,pch=20, cex=1.5, col="grey82") 
> abline(0, 1, lty=2); 
> segments(1-r$spec, 1-r$spec, 1-r$spec, r$sens, lty=3) 
> #text(1 - max(r$spec,na.rm=T), 
> r$sens[which.max(r$spec)],r$pts[which.max(r$spec)],pos=2,cex=0.8) 
> text(0, 0.9, paste("Area under ROC:",round(logit.roc.area(r),4)), pos=4) 
> title(main = title) 
> } 
> r[5,]=c(0,0,1,10) 
> logit.roc.plot(r) 
> r=r[-5,] 
> text(1 - max(r$spec,na.rm=T), 
> r$sens[which.max(r$spec)],r$pts[which.max(r$spec)],pos=2,cex=0.8) 
> 
> while r is  a MATRIX (4x4) with 
> colnames=c("pts",sens","spec",iterationnumber.") 
> and I have for each ROC curve a different matrix but all matrices have the

> same 
> size. (They are organized as a list of 10 matrices by the size 4X4 each) 
> 
> Would appreciate your help in putting all ROC curves on the same plot. 
> Thank you 


The reason you are getting new plots each time is the plot() call in the 
function.  If you pull the plot initialization out of the function (so 
that the limits and axis labels get set up only once), then that plot 
could be replaced with a points call. 

-- 
Brian S. Diggs, PhD 
Senior Research Associate, Department of Surgery 
Oregon Health & Science University 

__ 
[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. 



  _  

If you reply to this email, your message will be added to the discussion
below:

http://r.789695.n4.nabble.com/plotting-several-ROC-curves-on-the-same-graph-
tp3414263p3415433.html 

To unsubscribe from plotting several ROC curves on the same graph, click
here
<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by
_code&node=3414263&code=bWV5dGFyQHR4LnRlY2huaW9uLmFjLmlsfDM0MTQyNjN8NzgxMTk0
Mzk3> . 



--
View this message in context: 
http://r.789695.n4.nabble.com/plotting-several-ROC-curves-on-the-same-graph-tp3414263p3415569.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

__
R-help@r-project.org 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] plotting several ROC curves on the same graph

2011-03-29 Thread meytar
Hello 
I am trying to make a graph of 10 different lines built each from 4
different 
segments and to add a darker line that will represent the average of all
graphs 
- all in the same plot.Actually each line is a ROC plot 
The code I'm using for plotting one line is as follows: 

logit.roc.plot <- function(r, title="ROC curve") { 
old.par <- par(no.readonly = TRUE); on.exit(par(old.par)) 
par(xaxs="i", yaxs="i") 
plot(1 - r$spec, r$sens, xlim=c(0, 1), ylim=c(0,1), type="l", 
xlab="(1 - specificity): false positive rate", 
ylab="sensitivity: true positive rate", 
col="grey82", lwd=2); 
points(1 - r$spec, r$sens,pch=20, cex=1.5, col="grey82") 
abline(0, 1, lty=2); 
segments(1-r$spec, 1-r$spec, 1-r$spec, r$sens, lty=3) 
#text(1 - max(r$spec,na.rm=T), 
r$sens[which.max(r$spec)],r$pts[which.max(r$spec)],pos=2,cex=0.8) 
text(0, 0.9, paste("Area under ROC:",round(logit.roc.area(r),4)), pos=4) 
title(main = title) 
} 
r[5,]=c(0,0,1,10) 
logit.roc.plot(r) 
r=r[-5,] 
text(1 - max(r$spec,na.rm=T), 
r$sens[which.max(r$spec)],r$pts[which.max(r$spec)],pos=2,cex=0.8) 

while r is  a MATRIX (4x4) with 
colnames=c("pts",sens","spec",iterationnumber.") 
and I have for each ROC curve a different matrix but all matrices have the
same 
size. (They are organized as a list of 10 matrices by the size 4X4 each) 

Would appreciate your help in putting all ROC curves on the same plot. 
Thank you 

-- 
Meytar

--
View this message in context: 
http://r.789695.n4.nabble.com/plotting-several-ROC-curves-on-the-same-graph-tp3414263p3414263.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.


Re: [R] (no subject)

2011-03-29 Thread Meytar Sorek-Hamer
Hellp
I posted a message but didn't get any reply
How can I send it again please?
Thank you
Meytar

__
R-help@r-project.org 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] How can I plot several ROC curves on the same graph?

2011-03-28 Thread meytar
Hello
I am trying to make a graph of 10 different lines built each from 4 different
segments and to add a darker line that will represent the average of all graphs
- all in the same plot.Actually each line is a ROC plot
The code I'm using for plotting one line is as follows:

logit.roc.plot <- function(r, title="ROC curve") {
old.par <- par(no.readonly = TRUE); on.exit(par(old.par))
par(xaxs="i", yaxs="i")
plot(1 - r$spec, r$sens, xlim=c(0, 1), ylim=c(0,1), type="l",
xlab="(1 - specificity): false positive rate",
ylab="sensitivity: true positive rate",
col="grey82", lwd=2);
points(1 - r$spec, r$sens,pch=20, cex=1.5, col="grey82")
abline(0, 1, lty=2);
segments(1-r$spec, 1-r$spec, 1-r$spec, r$sens, lty=3)
#text(1 - max(r$spec,na.rm=T),
r$sens[which.max(r$spec)],r$pts[which.max(r$spec)],pos=2,cex=0.8)
text(0, 0.9, paste("Area under ROC:",round(logit.roc.area(r),4)), pos=4)
title(main = title)
}
r[5,]=c(0,0,1,10)
logit.roc.plot(r)
r=r[-5,]
text(1 - max(r$spec,na.rm=T),
r$sens[which.max(r$spec)],r$pts[which.max(r$spec)],pos=2,cex=0.8)

while r is  a MATRIX (4x4) with
colnames=c("pts",sens","spec",iterationnumber.")
and I have for each ROC curve a different matrix but all matrices have the same
size. (They are organized as a list of 10 matrices by the size 4X4 each)

Would appreciate your help in putting all ROC curves on the same plot.
Thank you

-- 
Meytar

__
R-help@r-project.org 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.


Re: [R] using rpart with a tree misclassification condition

2010-11-22 Thread meytar

Thank you for your prompt reply!
Yes, I meant the apparent error rate.
According to your advice, if I use "rpart" to build a full tree, what
pruning command will be appropriate and will able me to add as an input to
the pruning procedure the total error rate i'm looking for?
Thank you very much
Meytar
-- 
View this message in context: 
http://r.789695.n4.nabble.com/using-rpart-with-a-tree-misclassification-condition-tp3053167p3053230.html
Sent from the R help mailing list archive at Nabble.com.

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] using rpart with a tree misclassification condition

2010-11-22 Thread meytar

Hello
I want to build a classification tree for a binary response variable
while the condition for the final tree should be :
The total misclassification for each group (zero or one) will be less then
10% .
for example: if I have in the root 100 observations, 90 from group 0 and 10
from group 1, I want that in the final tree a maximum of 9 and 1
observations out of group 0 and 1, respectively, will be misclassified.
Does anyone know what code will be appropriate for implementing this
condition?
Thank you in advance
Meytar 
-- 
View this message in context: 
http://r.789695.n4.nabble.com/using-rpart-with-a-tree-misclassification-condition-tp3053167p3053167.html
Sent from the R help mailing list archive at Nabble.com.

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.