indexMann=find(StudDataV2011(:,1)==1)
indexKvinne=find(StudDataV2011(:,1)==2)
hogdeMann=StudDataV2011(indexMann,2)
hogdeKvinne=StudDataV2011(indexKvinne,2)


alfa=0.05;
n1=18;
n2=5;


%Antar kjent varians/standaravvik:  sigma = 6
sigma=6;
z_alfahalve=norminv(1-alfa/2, 0,1);

%Case 1
mean(hogdeKvinne)-z_alfahalve*sigma/sqrt(n1)
mean(hogdeKvinne)+z_alfahalve*sigma/sqrt(n1)

%Case 2
mean(hogdeKvinne)-z_alfahalve*sigma/sqrt(n2)
mean(hogdeKvinne)+z_alfahalve*sigma/sqrt(n2)


%T-test: 'Estimerer varians', antar at estimatet blir 36, for å 
%få samanliknbare resultat
sigma=6;
%Case 1
mean(hogdeKvinne)-tinv(1-alfa/2,n1-1)*sigma/sqrt(n1)
mean(hogdeKvinne)+tinv(1-alfa/2,n1-1)*sigma/sqrt(n1)

%Case 2
mean(hogdeKvinne)-tinv(1-alfa/2,n2-1)*sigma/sqrt(n2)
mean(hogdeKvinne)+tinv(1-alfa/2,n2-1)*sigma/sqrt(n2)



%For menn: Antar kjent varians/standaravvik:  sigma = 6
sigma=6;
z_alfahalve=norminv(1-alfa/2, 0,1);
n3=91;
%Case 1
mean(hogdeMenn)-z_alfahalve*sigma/sqrt(n1)
mean(hogdeMenn)+z_alfahalve*sigma/sqrt(n1)