[R] Rug plot curve reversal

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Oct 4 18:11:40 CEST 2011



On 04.10.2011 13:30, Peter Minting wrote:
>
> Dear R-help
> Can anyone tell me why my curve appears the wrong way round on a rug plot?
> I am using the same code as on pg 596 of the Crawley R-book.

> mod<-glm(mort~logBd,binomial)

What is mort, what is logBd? I don't have access to the book. I have 
hidden it in my other office so that nobody can find it anymore.


> par(mfrow=c(2,2))
> xv<-seq(0,8,0.01)
> yv<-predict(mod,list(logBd=xv),type="response")
> plot(logBd,mort)
> lines(xv,yv)
> I've tried swapping xv and yv around but no luck.

Hopefully mort is a binary factor, i.e. with two levels. I that case 
they are at positions 1 and 2 on the y axis in plot().
yv is the reponse, i.e. is in the interval (0,1) if the binomial glm was 
successful. So a different scale.

So I guess
  lines(xv,yv+1)
could help.

Whatelse I think about "The R Book" can be found in my book review 
published in "Statistical Papers".

Best,
Uwe Ligges






> Thanks,
> Pete 		 	   		
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list