Files
2024-08-31 12:07:21 +03:00

41 lines
1.2 KiB
Matlab

X=[4.6 0.7 4.2 1.9 4.8 6.1 4.7 5.5 5.4];
Y=[2.5 1.3 2.0 1.8 2.7 3.2 3.0 3.5 3.4];
nx=length(X);
ny=length(Y);
vx=var(X);
vy=var(Y);
#The null hypothesis is: H0: vx!=vy (the standard is meet)
#The alternative hypothesis is: H1: vx=vy (the standard is not meet)
#Both tail test for u when sigma is unknown
#oneminusalpha = input("Confidence level: (between 0 and 1)");
oneminusalpha = 0.95;
alpha = 1-oneminusalpha;
[H, PVAL, CI, ZVALUE] = vartest2(X,Y,'alpha',alpha,'tail','both');
if H==1
printf("The null hypothesis is rejected\n\n");
printf("The data suggests that the standard is not meet\n\n");
else
printf("The null hypothesis is not rejected\n\n");
printf("The data suggests that the standard is meet\n\n");
endif
#The null hypothesis is: H0: mx!=my (the standard is meet)
#The alternative hypothesis is: H1: mx=my (the standard is not meet)
#Both tail test for u when sigma is unknown
[H, PVAL, CI, ZVALUE] = ttest2(X,Y,'alpha',alpha,'tail','both');
if H==1
printf("The null hypothesis is rejected\n\n");
printf("The data suggests that the standard is not meet\n\n");
else
printf("The null hypothesis is not rejected\n\n");
printf("The data suggests that the standard is meet\n\n");
endif