# NOT RUN {
library(basicTrendline)
x1<-1:5
x2<- -2:2
x3<- c(101,105,140,200,660)
x4<- -5:-1
x5<- c(1,30,90,180,360)
y1<-c(2,14,18,19,20) # increasing convex trend
y2<- c(-2,-14,-18,-19,-20) # decreasing concave trend
y3<-c(2,4,16,38,89) # increasing concave trend
y4<-c(-2,-4,-16,-38,-89) # decreasing convex trend
y5<- c(600002,600014,600018,600019,600020) # high y values with low range.
trendline(x1,y1,model="line2P",summary=TRUE,eDigit=10)
trendline(x2,y2,model="line3P",summary=FALSE,ePos="topright")
trendline(x3,y3,model="log2P",linecolor="blue")
trendline(x4,y4,model="exp3P",eSize=0.7) #change the font size of equation.
trendline(x5,y5,model="power3P")
## Not run
plot(x1,y1,main="Different regression lines in one plot")
library(basicTrendline)
trendline(x1,y1,model="line2P",plot=FALSE,ePos="none",linecolor="red")
trendline(x1,y1,model="log2P",plot=FALSE,ePos="none",linecolor="blue",lty=2)
trendline(x1,y1,model="exp3P",plot=FALSE,ePos="none",linecolor="black",lty=3)
legend("bottomright",c("line2P","log2P","exp3P"), lty=c(1,2,3),col=c("red","blue","black"))
## END (Not run)
# }
Run the code above in your browser using DataLab