################################################################################# # Bayesian model selection and statistical modeling # Chapman & Hall/CRC Taylor and Francis Group # # Chapter1: Section1.1 # # Analysis of Nikkei 225 index # # Author : Tomohiro Ando # ################################################################################ # Read Nikkei225 data x <- scan("Nikkei225-index.txt") # Time-series plot plot(x,xlab="",ylab="The daily returns of Nikkei 225 index",type="n") lines(x,lwd=2) # parameter estimates m <- mean(x) s <- sd(x) # Histgram plot and fitted normal density r <- hist(x,br=seq(min(x),max(x),len=40),probability=T,xlab="",main="",ylim=c(0,0.5)) d <- dnorm(x,m,sqrt(s)) lines(x,d,col=1,lwd=2,lty=2)