Advertisement
Guest User

Proj

a guest
Jul 24th, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. data = menu('Data or stats? ','Data','Stats');
  2. if(data==1)
  3. dataVal = input('What are the values contained in your vector1? \n');
  4. dataVal2 = input('What are the values contained in your vector2? \n');
  5. alpha = input('\n What is your alpha level? ');
  6. h1 = menu(' What is your H1 saying in regards to comparison? ', 'both not equal', 'greater than' ,'less than');
  7. difference = menu('Is your sigmas the same between each vector? ','Yes','No');
  8. if(difference==1)
  9.  
  10. if(h1==1)
  11. [h p ci stats]=ttest2(dataVal,dataVal2,'alpha',alpha,'tail','both','vartype','equal');
  12. elseif(h1==2)
  13. [h p ci stats]=ttest2(dataVal,dataVal2,'alpha',alpha,'tail','left','vartype','equal');
  14. else
  15. [h p ci stats]=ttest2(dataVal,dataVal2,'alpha',alpha,'tail','right','vartype','equal');
  16. end
  17. else
  18. if(h1==1)
  19. [h p ci stats]=ttest2(dataVal,dataVal2,'alpha',alpha,'tail','both','vartype','unequal');
  20. elseif(h1==2)
  21. [h p ci stats]=ttest2(dataVal,dataVal2,'alpha',alpha,'tail','left','vartype','unequal');
  22. else
  23. [h p ci stats]=ttest2(dataVal,dataVal2,'alpha',alpha,'tail','right','vartype','unequal');
  24. end
  25. end
  26. lprintf('\n Your z value is: %.4f ',z);
  27. lprintf('\nThe p value is : %.4f ',p);
  28. if(p < alpha)
  29. lprintf('\n You Fail to reject the Null');
  30. else
  31. lprintf('\n You reject the Null');
  32. end
  33. lprintf('\n Your confidence interval is : %.4f ',ci);
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement