obj <-function(theta, y, alpha, theta_mle){llik_Exp(theta, y) - (llik_Exp(theta_mle, y) -qchisq(1-alpha, 1)/2)}curve(obj(theta=x, y, alpha, theta_mle), xlim=c(0,25))abline(h=0, col=2)LRT_CI <-numeric(2)# uniroot searches the zero of a function:LRT_CI[1] <-uniroot(function(x) obj(theta=x, y, alpha, theta_mle), interval=c(0.0001, theta_mle))$rootLRT_CI[2] <-uniroot(function(x) obj(theta=x, y, alpha, theta_mle), interval=c(theta_mle, 25))$rootabline(v=LRT_CI, lty=2)