#Example:
curve(x^2, col = "red")
curve(x^2, col = "red")
curve(x^3-x+1.5,from=-10,to=10,lty=2, col = "blue")
# normal curve
x=seq(-50,150,length=1000)
set.seed(1234)
y=dnorm(x,mean=50,sd=30)
plot(x,y,type="l",lwd=2,col="red")
y=dnorm(x,mean=50,sd=30)
plot(x,y,type="l",lwd=2,col="red")
# add one or more curves
curve(x^2-1, col = "green2")
curve(x^2-5*x, -2.5, 2.5, add = TRUE, col = "red")
# add curves to scatter plot
# xyscatter plot
set.seed(1234)
x = c(0.1, 0.2, 0.3, 0.4, 0.5)
y = (-0.5*log (1-(2*x)) + rnorm(length (x), 0.2, 0.1))
plot(x,y, col = "red", pch = 18)
curve(-0.5*log (1-(2*x)),from=0,to=0.5, lty=2, col = "blue", add = TRUE)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.