Re: [R] roc and lattice

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Wed 10 Jan 2007 - 08:00:07 GMT

On 1/9/07, rhk <mailing-lists@rhkoning.com> wrote:
> Hello, I am afraid I do not fully understand all intricacies of
> programming in lattice plots. In the code below I try to plot an ROC
> curve, following R-news 4(1). When I condition on the variable 'group' I
> get the error message below, when I plot the curve for all data (i.e., y
> ~ pred.prob), I get the plot I want. Can someone point out why
> conditioning gives that message? Thanks, Ruud
>
> > plot.a <- xyplot(y ~ pred.prob|group, data=x.df,

> + xlim=c(0,1),xlab="1-specificiteit",
> + ylab="sensitiviteit",
> + panel=function(x,y,subscripts,...){
> + DD <- table(-x,y)
> + sens <- cumsum(DD[,2])/sum(DD[,2])
> + mspec <- cumsum(DD[,1])/sum(DD[,1])
> + panel.xyplot(mspec,sens,type="l",...)
> + panel.abline(0,1)
> + })
> > print(plot.a)
> Error in panel(x = c(0.000265710002003069, 0.000345712857778025,
> 0.000265710002003069, :
> subscript out of bounds
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.

Since you haven't bothered to give us a reproducible example, all we can say is that somewhere in your code, a subscript is out of bounds. Since the only place where you use subscripts is as DD[,2] etc, I would start by checking if DD indeed has two columns and two rows as you seem to expect.

Deepayan



R-help@stat.math.ethz.ch 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. Received on Wed Jan 10 19:07:24 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 10 Jan 2007 - 09:30:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.