I made chart 1 below in R, from the code:
library(truncreg)
set.seed(1)
x <- sort(rnorm(50)+3)
y <- 3 + 1*x + rnorm(50,0,0.3)
compl <- data.frame(x,y)
y[y>6.5] <- 6.5
sample <- data.frame(x,y)
pred.OLS <- predict( lm(y~x, data=sample) )
pred.trunc <- predict( truncreg(y~x, data=compl,point = 12.04,direction = "right"))
plot( compl$x, compl$y, pch= 1,xlab="x",ylab="y",ylim=NULL,xlim=NULL)
points(sample$x,sample$y, pch=16)
lines( sample$x,pred.OLS, lty=2,lwd=2)
lines( compl$x,pred.trunc,lty=1,lwd=2)
abline(h=6.5,lty=3) # horizontal line at 0
abline(v=3.5,lty=3)
However,Iwanttomakethischart:
Does anyone know how I can proceed? I have not found how to remove the numeric values of the axes nor how to add the $k$ e $x_{0}.$
intercepts. If you have suggestions on how to do with ggplot, I am even more grateful!