## ILYAplot1.s

## n = 15, 30, 40, 75, 200, 500.  See outapprox202.txt


n <- c(1,2,3,4,5,10,15,20,30,40,50,75,100,150,200,500)

cr1 <- as.numeric(matrix(scan("out202.txt",skip=5,
what="char"),ncol=9,byrow=T)[,9])[c(2,6,10,14,18,22)]

x <- matrix(rep(0,(length(n)*6)),ncol=6)
x[,1] <- n
a1 <- c(2,5,10,20,50,100)
a2 <- rep(0,length(a1))
for(i in c(1:length(a1))) a2[i] <- c(1:length(n))[n==a1[i]]
x[a2,2] <- cr1

a3 <- matrix(scan("outapprox201.txt",skip=3),ncol=4,byrow=T)
a4 <- a3[c(2,6,10,14,18,22),]
x[a2,3:4] <- a4[,3:4]

a5 <- matrix(scan("outapprox202.txt",skip=1),ncol=4,byrow=T)
a6 <- c(15,30,40,75,200,500)
a7 <- rep(0,length(a6))
for(i in c(1:length(a6))) a7[i] <- c(1:length(n))[n==a6[i]]
x[a7,2:4] <- a5[,2:4]

x[14,2:4] <- c(1685.63,1674.253,1684.789)  ### n=150

a5 <- matrix(scan("outapprox204.txt",skip=1),ncol=4,byrow=T)
a6 <- c(1,3,4)
a7 <- rep(0,length(a6))
for(i in c(1:length(a6))) a7[i] <- c(1:length(n))[n==a6[i]]
x[a7,2:4] <- a5[,2:4]

x[,5] <- (x[,3]-x[,2])/x[,2]*100
x[,6] <- (x[,4]-x[,2])/x[,2]*100





postscript("fig1big.ps", width = 6, height = 6)
plot(c(0,max(x[,1])),c(0,max(x[,2])*1.1),type="n",xlab="n",ylab="quantile")
lines(x[,1],x[,2],lty=1)
lines(x[,1],x[,3],lty=2)
lines(x[,1],x[,4],lty=3)
dev.off()

## solid  = true cn, from simulations
## dotted = cn-hat
## dashed = cn=tilde

postscript("fig2.ps", width = 5, height = 3)
plot(c(1,max(x[,1])),c(-1.5,1.5),type="n",xlab="n",ylab="% error",log="x")
lines(x[,1],x[,5],lty=2)
lines(x[,1],x[,6],lty=3)
dev.off()

## dotted = cn-hat
## dashed = cn=tilde
