📄 students_t_single_sample.cpp
字号:
// Print size: cout << fixed << setprecision(0) << setw(16) << right << size << endl; } cout << endl;}int main(){ // // Run tests for Heat Flow Meter data // see http://www.itl.nist.gov/div898/handbook/eda/section4/eda428.htm // The data was collected while calibrating a heat flow meter // against a known value. // confidence_limits_on_mean(9.261460, 0.2278881e-01, 195); single_sample_t_test(5, 9.261460, 0.2278881e-01, 195, 0.05); single_sample_find_df(5, 9.261460, 0.2278881e-01); // // Data for this example from: // P.K.Hou, O. W. Lau & M.C. Wong, Analyst (1983) vol. 108, p 64. // from Statistics for Analytical Chemistry, 3rd ed. (1994), pp 54-55 // J. C. Miller and J. N. Miller, Ellis Horwood ISBN 0 13 0309907 // // Determination of mercury by cold-vapour atomic absorption, // the following values were obtained fusing a trusted // Standard Reference Material containing 38.9% mercury, // which we assume is correct or 'true'. // confidence_limits_on_mean(37.8, 0.964365, 3); // 95% test: single_sample_t_test(38.9, 37.8, 0.964365, 3, 0.05); // 90% test: single_sample_t_test(38.9, 37.8, 0.964365, 3, 0.1); // parameter estimate: single_sample_find_df(38.9, 37.8, 0.964365); return 0;}/*Output:------ Build started: Project: students_t_single_sample, Configuration: Debug Win32 ------Compiling...students_t_single_sample.cppLinking...Autorun "i:\boost-06-05-03-1300\libs\math\test\Math_test\debug\students_t_single_sample.exe"__________________________________2-Sided Confidence Limits For Mean__________________________________Number of Observations = 195Mean = 9.26146Standard Deviation = 0.02278881_______________________________________________________________Confidence T Interval Lower Upper Value (%) Value Width Limit Limit_______________________________________________________________ 50.000 0.676 1.103e-003 9.26036 9.26256 75.000 1.154 1.883e-003 9.25958 9.26334 90.000 1.653 2.697e-003 9.25876 9.26416 95.000 1.972 3.219e-003 9.25824 9.26468 99.000 2.601 4.245e-003 9.25721 9.26571 99.900 3.341 5.453e-003 9.25601 9.26691 99.990 3.973 6.484e-003 9.25498 9.26794 99.999 4.537 7.404e-003 9.25406 9.26886__________________________________Student t test for a single sample__________________________________Number of Observations = 195Sample Mean = 9.26146Sample Standard Deviation = 0.02279Expected True Mean = 5.00000Sample Mean - Expected Test Mean = 4.26146Degrees of Freedom = 194T Statistic = 2611.28380Probability that difference is due to chance = 0.000e+000Results for Alternative Hypothesis and alpha = 0.0500Alternative Hypothesis ConclusionMean != 5.000 NOT REJECTEDMean < 5.000 REJECTEDMean > 5.000 NOT REJECTED_____________________________________________________________Estimated sample sizes required for various confidence levels_____________________________________________________________True Mean = 5.00000Sample Mean = 9.26146Sample Standard Deviation = 0.02279_______________________________________________________________Confidence Estimated Estimated Value (%) Sample Size Sample Size (one sided test) (two sided test)_______________________________________________________________ 50.000 2 2 75.000 2 2 90.000 2 2 95.000 2 2 99.000 2 2 99.900 3 3 99.990 3 3 99.999 4 4__________________________________2-Sided Confidence Limits For Mean__________________________________Number of Observations = 3Mean = 37.8000000Standard Deviation = 0.9643650_______________________________________________________________Confidence T Interval Lower Upper Value (%) Value Width Limit Limit_______________________________________________________________ 50.000 0.816 0.455 37.34539 38.25461 75.000 1.604 0.893 36.90717 38.69283 90.000 2.920 1.626 36.17422 39.42578 95.000 4.303 2.396 35.40438 40.19562 99.000 9.925 5.526 32.27408 43.32592 99.900 31.599 17.594 20.20639 55.39361 99.990 99.992 55.673 -17.87346 93.47346 99.999 316.225 176.067 -138.26683 213.86683__________________________________Student t test for a single sample__________________________________Number of Observations = 3Sample Mean = 37.80000Sample Standard Deviation = 0.96437Expected True Mean = 38.90000Sample Mean - Expected Test Mean = -1.10000Degrees of Freedom = 2T Statistic = -1.97566Probability that difference is due to chance = 1.869e-001Results for Alternative Hypothesis and alpha = 0.0500Alternative Hypothesis ConclusionMean != 38.900 REJECTEDMean < 38.900 REJECTEDMean > 38.900 REJECTED__________________________________Student t test for a single sample__________________________________Number of Observations = 3Sample Mean = 37.80000Sample Standard Deviation = 0.96437Expected True Mean = 38.90000Sample Mean - Expected Test Mean = -1.10000Degrees of Freedom = 2T Statistic = -1.97566Probability that difference is due to chance = 1.869e-001Results for Alternative Hypothesis and alpha = 0.1000Alternative Hypothesis ConclusionMean != 38.900 REJECTEDMean < 38.900 NOT REJECTEDMean > 38.900 REJECTED_____________________________________________________________Estimated sample sizes required for various confidence levels_____________________________________________________________True Mean = 38.90000Sample Mean = 37.80000Sample Standard Deviation = 0.96437_______________________________________________________________Confidence Estimated Estimated Value (%) Sample Size Sample Size (one sided test) (two sided test)_______________________________________________________________ 50.000 2 2 75.000 3 4 90.000 7 9 95.000 11 13 99.000 20 22 99.900 35 37 99.990 50 53 99.999 66 68Build Time 0:03Build log was saved at "file://i:\boost-06-05-03-1300\libs\math\test\Math_test\students_t_single_sample\Debug\BuildLog.htm"students_t_single_sample - 0 error(s), 0 warning(s)========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -