Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data = menu('Data or stats? ','Data','Stats');
- if(data==1)
- dataVal = input('What are the values contained in your vector1? \n');
- dataVal2 = input('What are the values contained in your vector2? \n');
- alpha = input('\n What is your alpha level? ');
- h1 = menu(' What is your H1 saying in regards to comparison? ', 'both not equal', 'greater than' ,'less than');
- difference = menu('Is your sigmas the same between each vector? ','Yes','No');
- if(difference==1)
- if(h1==1)
- [h p ci stats]=ttest2(dataVal,dataVal2,'alpha',alpha,'tail','both','vartype','equal');
- elseif(h1==2)
- [h p ci stats]=ttest2(dataVal,dataVal2,'alpha',alpha,'tail','left','vartype','equal');
- else
- [h p ci stats]=ttest2(dataVal,dataVal2,'alpha',alpha,'tail','right','vartype','equal');
- end
- else
- if(h1==1)
- [h p ci stats]=ttest2(dataVal,dataVal2,'alpha',alpha,'tail','both','vartype','unequal');
- elseif(h1==2)
- [h p ci stats]=ttest2(dataVal,dataVal2,'alpha',alpha,'tail','left','vartype','unequal');
- else
- [h p ci stats]=ttest2(dataVal,dataVal2,'alpha',alpha,'tail','right','vartype','unequal');
- end
- end
- lprintf('\n Your z value is: %.4f ',z);
- lprintf('\nThe p value is : %.4f ',p);
- if(p < alpha)
- lprintf('\n You Fail to reject the Null');
- else
- lprintf('\n You reject the Null');
- end
- lprintf('\n Your confidence interval is : %.4f ',ci);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement