n=matrix(scan("C:/Users/wenche_adm/Desktop/Nils/uio/Autumn2013/Exercises/norwegianclaims1.txt"),byrow=T,ncol=5);
nozeroclaims=n[,5];
z = nozeroclaims[nozeroclaims>0];
c(mean(z),sd(z),min(z),max(z));
summary(z);
qqnorm((log(z)-mean(log(z)))/sd(log(z)))
n=10000;
candidate=rlnorm(n,(log(z)-mean(log(z)))/sd(log(z)));
sample=(log(z)-mean(log(z)))/sd(log(z));
plot(density(sample),col="blue");
lines(density(candidate),col="green")
c(mean(z),sd(z),min(z),max(z));
c(exp(mean(candidate)),exp(sd(candidate)),exp(min(candidate)),exp(max(candidate)));
quantile(z,c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.95,0.99))
zc=exp(candidate);
quantile(zc,c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.95,0.99))
plot(density(z))
qqnorm((log(z)-mean(log(z)))/sd(log(z)))