[R] R lines type in a glm/predict model
laurafdez56
laura.fernandezp at edu.uah.es
Mon Sep 14 14:11:27 CEST 2015
Hi everyone!
I want to change the line type into a square/circle/triangle in a plot, and
I can not find the way, could someone help me please?? I used the
glm/predict function to predict the curves.
Here is my code:
glm1<-glm(Supervivencia~Temperatura*Especie,pinos,family=binomial)
range(pinos$Temperatura)
xv<-5:-30
sp1<-rep("P.halepensis:-11.6(-10.6,-12)",length(xv))
sp2<-rep("P.nigra:-23.6(-22.9,-23.9)",length(xv))
sp3<-rep("P.pinaster:-19.2(-18.7,-19.4)",length(xv))
sp4<-rep("P.pinea:-12.4(-11.8,-12.7)",length(xv))
sp5<-rep("P.sylvestris:-21.4(-20.9,-21.6)",length(xv))
sp6<-rep("P.uncinata:-21.3(-20.7,-21.6)",length(xv))
yv1<-predict(glm1,list(Temperatura=xv,Especie=sp1),type="response")
yv2<-predict(glm1,list(Temperatura=xv,Especie=sp2),type="response")
yv3<-predict(glm1,list(Temperatura=xv,Especie=sp3),type="response")
yv4<-predict(glm1,list(Temperatura=xv,Especie=sp4),type="response")
yv5<-predict(glm1,list(Temperatura=xv,Especie=sp5),type="response")
yv6<-predict(glm1,list(Temperatura=xv,Especie=sp6),type="response")
plot(Supervivencia~Temperatura,pinos, xlab=(expression(Temperature *
degree~C)), ylab="Survival",type="n")
lines(xv,yv1,lwd=2,lty=5, col="black")###halepensis
lines(xv,yv2,lwd=2,lty=6, col="black")###nigra
lines(xv,yv3,lwd=2,lty=1, col="black")###pinaster
lines(xv,yv4,lwd=2,lty=4, col="black")###pinea
lines(xv,yv5,lwd=2,lty=3, col="black")###sylvestris
lines(xv,yv6,lwd=2,lty=2, col="black")###uncinta
abline(0.5,0, col="black", lty=7)
legend(legend=levels(pinos$Especie),"topleft",bty="n",lty=c(lty=5,lty=6,lty=1,lty=4,lty=3,lty=2))
--
View this message in context: http://r.789695.n4.nabble.com/R-lines-type-in-a-glm-predict-model-tp4712219.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list