R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> pdf("g01.pdf");options(width=64)
> #setwd("C:\\Users\\kolassa\\Class553")
> setwd("~/Taught1/960-553/Data")
> theta<-(-5:50)/10
> lfcn<-function(theta) return(list(d0=4-(theta-3)^2/2,d1=-(theta-3),mle=3))
> nulltheta<-1
> nullout<-lfcn(nulltheta)
> mleout<-lfcn(nullout[[3]])
> plot.default(theta,lfcn(theta)[[1]],type="l",xaxt="n",frame.plot=FALSE,
+    yaxt="n",xlab="Parameter",ylab="Log likelihood",
+    sub="Second derivative of log likelihood is 1",
+    main="Construction of Likelihood-Based Tests")
> axis(1,at=c(min(theta),nulltheta,nullout[[3]],max(theta)),
+    labels=c("","theta0","thetahat",""), pos=0)
> segments(mleout$mle,mleout$d0,nullout$mle,nullout$d0,lty=2)
> abline(h=nullout$d0,lty=3)
> abline(0,nullout$d1,lty=4)
> segments(nulltheta,0.1,nullout$mle,0.1,lty=5)
> legend(0,-.5,legend=c("Log likelihood",
+    "Square root of length times two gives likelihood ratio statistic",
+    "Level of log likelihood at null hypothesis",
+    "Slope of this line gives score statistic",
+    "Length gives Wald statistic"),lty=1:5)
> #******************************************************/
> # General Continuous Confidence Interval Construction */
> #******************************************************/
> #If necessary, install TheorStat using
> #library(devtools) ; install_github("kolassa-dev/TheorStat")
> library(TheorStat)#For ctsci
> ctsci()
> #***************************************************/
> # Graphical Demonstration of Continuity Correction */
> #***************************************************/
> library(TheorStat)#For ccplot
> ccplot()
>