for j=1:5
mu=3.175174;
sigma = 1.080145;
X = normrnd(mu,sigma,1,100000);
mean(X>6)
end


























%normal avhengighet
mu = 3.191;sigma=0.254;
a=[1.0028  0.0750  0.0148 -0.1325];
%Set første 4 lik observasjoner
x = zeros(1,365);
x(1:4) = [3.7 4.1 3.9 4.2];
M=1000;y=zeros(1,M);
for m = 1:M
    for j = 5:365
        x(j) = mu + a(1)*(x(j-1)-mu)+a(2)*(x(j-2)-mu)+ ...
                    a(3)*(x(j-3)-mu)+a(4)*(x(j-4)-mu)+ ...
                    normrnd(0,sigma,1,1);
    end
    y(m) = max(x)>6;
end
mean(y)
plot(1:365,x(1,:))


%lognormal avhengighet
mu = 1.100;sigma=0.075;
a=[0.99546559  0.09112007  0.02883564 -0.09746754 -0.05103634];
%Set første 5 lik observasjoner
x = zeros(1,365);
x(1:5) = [1.308 1.411 1.361 1.435 1.548];
M=1000;y=zeros(1,M);
for m = 1:M
    for j = 6:365
        x(j) = mu + a(1)*(x(j-1)-mu)+a(2)*(x(j-2)-mu)+ ...
                    a(3)*(x(j-3)-mu)+a(4)*(x(j-4)-mu)+ ...
                    a(5)*(x(j-5)-mu)+normrnd(0,sigma,1,1);
    end
    y(m) = max(x)>log(6);
end
mean(y)
plot(1:365,x(1,:))
