# (C) Petteri Pajunen 2006 # X11(width=5,height=5) thseq <- seq(0,5,by=1) simseq <- seq(0,5,by=0.01) x <- c(0,0,0,0,0,0) for (outlier in thseq) { x[6] <- outlier theta <- mean(x) plot(1:6,x,type="p",ylim=c(-0.5,5.5),col="red",lwd=3,main="MLE: NORMAL NOISE WITH CONSTANT VARIANCE") lines(1:6,theta*matrix(1,1,6),lwd=2) scan(quiet=TRUE) } for (outlier in thseq) { x[6] <- outlier s <- (0.5*(outlier-simseq)^2+2)^(-3)*((0.5*(simseq)^2+2)^(-3))^5 theta <- simseq[which(s==max(s))] plot(1:6,x,type="p",ylim=c(-0.5,5.5),col="red",lwd=3,main="MAP: NORMAL NOISE, RANDOM VARIANCE, GAMMA PRIOR") lines(1:6,theta*matrix(1,1,6),lwd=2) scan(quiet=TRUE) } dev.off()