# haal de eerste regels in E76-hpkoersen.txt en in E76-hplogreturns.txt weg alvorens onderstaande code te runnen hp = scan("E76-hpkoersen.txt") logreturns = scan("E76-hplogreturns.txt") hp=hpkoersen[,1] logreturns=hplogreturns[,1] # FIGUUR 2.13 par(mfrow=c(1,2)) acf(logreturns,main="",ylab="",xlab="") acf(logreturns^2,main="",ylab="",xlab="") #fig 4.14 par(mfrow=c(2,1)) jaar = seq(1984,1992-1/250,by=1/250) plot(jaar,hp,type="l",xlab="",ylab="") plot(jaar,logreturns,type="l",xlab="",ylab="") # tabel n=length(logreturns) mean(logreturns); sd(logreturns) mean(logreturns[1:500]); sd(logreturns[1:500]) mean(logreturns[501:1000]); sd(logreturns[501:1000]) mean(logreturns[1001:1500]); sd(logreturns[1001:1500]) mean(logreturns[1501:2000]); sd(logreturns[1501:2000]) # FIGUUR 4.15 par(mfrow=c(1,2)) hist(logreturns[1001:1500],prob=TRUE,nclass=15,main="",xlab="",ylab="") x=seq(-0.10,0.10,by=0.0001) lines(x,dnorm(x,mean(logreturns[1001:1500]),sd(logreturns[1001:1500]))) qqnorm(logreturns[1001:1500],main="",xlab="",ylab="") # FIGUUR 4.16 par(mfrow=c(1,1)) plot(sort(logreturns[1001:1500]),(1:500)/500,type="s",main="",xlab="",ylab="") lines(x,pnorm(x,mean(logreturns[1001:1500]),sd(logreturns[1001:1500])))