[R] Help with segmented package

vito.muggeo vito.muggeo at unipa.it
Thu Mar 1 22:47:13 CET 2012


dear Phil,
plot.segmented() accepts vectorized 'col', 'lty' and 'lwd' arguments. Then,

par(mfrow=c(1,2))
plot(o.seg,col=2:3,lty=2:3,lwd=c(1,2)) 
plot(z,y)
plot(o.seg,col=2:3,lty=1,linkinv=T,add=T,lwd=2) 
 

hope this helps you,
vito


On Thu, 1 Mar 2012 08:57:39 -0800 (PST), Filoche wrote
> Hi everyone.
> 
> I'm using segmented package to find break point in a bi-linear relationship.
> In a particular case, I find 1 pointcut (so 2 slopes).
> 
> I would like to know if it is possible to retrieve information in the
> segmented object that could let me to plot 1 particular segment with a
> different color.
> 
> For example, in that folowing example, I would like to plot the second
> segment in red.
> 
> library(segmented)
> set.seed(1234)
> z<-runif(100)
> y<-rpois(100,exp(2+1.8*pmax(z-.6,0)))
> o<-glm(y~z,family=poisson)
> o.seg<-segmented(o,seg.Z=~z,psi=list(z=.5))
> plot(o.seg)
> 
> Thank in advance,
> Phil
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Help-with-
> segmented-package-tp4435550p4435550.html Sent from the R help mailing list 
> archive at Nabble.com.
> 
> ______________________________________________
> 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.


--
Open WebMail Project (http://openwebmail.org)



More information about the R-help mailing list