📄 chi_square_std_dev_test.cpp
字号:
// Tests measurements of gear diameter. // confidence_limits_on_std_deviation(0.6278908E-02, 100); chi_squared_test(0.6278908E-02, 0.1, 100, 0.05); chi_squared_sample_sized(0.1 - 0.6278908E-02, 0.1); // // Run tests for silicon wafer fabrication data. // see http://www.itl.nist.gov/div898/handbook/prc/section2/prc23.htm // A supplier of 100 ohm.cm silicon wafers claims that his fabrication // process can produce wafers with sufficient consistency so that the // standard deviation of resistivity for the lot does not exceed // 10 ohm.cm. A sample of N = 10 wafers taken from the lot has a // standard deviation of 13.97 ohm.cm // confidence_limits_on_std_deviation(13.97, 10); chi_squared_test(13.97, 10.0, 10, 0.05); chi_squared_sample_sized(13.97 * 13.97 - 100, 100); chi_squared_sample_sized(55, 100); chi_squared_sample_sized(1, 100); // List confidence interval multipliers for standard deviation // for a range of numbers of observations from 2 to a million, // and for a few alpha values, 0.1, 0.05, 0.01 for condfidences 90, 95, 99 % confidence_limits_on_std_deviation_alpha(1., 0.1); confidence_limits_on_std_deviation_alpha(1., 0.05); confidence_limits_on_std_deviation_alpha(1., 0.01); return 0;}/*________________________________________________2-Sided Confidence Limits For Standard Deviation________________________________________________Number of Observations = 100Standard Deviation = 0.006278908_____________________________________________Confidence Lower Upper Value (%) Limit Limit_____________________________________________ 50.000 0.00601 0.00662 75.000 0.00582 0.00685 90.000 0.00563 0.00712 95.000 0.00551 0.00729 99.000 0.00530 0.00766 99.900 0.00507 0.00812 99.990 0.00489 0.00855 99.999 0.00474 0.00895______________________________________________Chi Squared test for sample standard deviation______________________________________________Number of Observations = 100Sample Standard Deviation = 0.00628Expected True Standard Deviation = 0.10000Test Statistic = 0.39030CDF of test statistic: = 1.438e-099Upper Critical Value at alpha: = 1.232e+002Upper Critical Value at alpha/2: = 1.284e+002Lower Critical Value at alpha: = 7.705e+001Lower Critical Value at alpha/2: = 7.336e+001Results for Alternative Hypothesis and alpha = 0.0500Alternative Hypothesis ConclusionStandard Deviation != 0.100 NOT REJECTEDStandard Deviation < 0.100 NOT REJECTEDStandard Deviation > 0.100 REJECTED_____________________________________________________________Estimated sample sizes required for various confidence levels_____________________________________________________________True Variance = 0.10000Difference to detect = 0.09372_______________________________________________________________Confidence Estimated Estimated Value (%) Sample Size Sample Size (lower one- (upper one- sided test) sided test)_______________________________________________________________ 50.000 2 2 66.667 2 5 75.000 2 10 90.000 4 32 95.000 5 52 99.000 8 102 99.900 13 178 99.990 18 257 99.999 23 337________________________________________________2-Sided Confidence Limits For Standard Deviation________________________________________________Number of Observations = 10Standard Deviation = 13.9700000_____________________________________________Confidence Lower Upper Value (%) Limit Limit_____________________________________________ 50.000 12.41880 17.25579 75.000 11.23084 19.74131 90.000 10.18898 22.98341 95.000 9.60906 25.50377 99.000 8.62898 31.81825 99.900 7.69466 42.51593 99.990 7.04085 55.93352 99.999 6.54517 73.00132______________________________________________Chi Squared test for sample standard deviation______________________________________________Number of Observations = 10Sample Standard Deviation = 13.97000Expected True Standard Deviation = 10.00000Test Statistic = 17.56448CDF of test statistic: = 9.594e-001Upper Critical Value at alpha: = 1.692e+001Upper Critical Value at alpha/2: = 1.902e+001Lower Critical Value at alpha: = 3.325e+000Lower Critical Value at alpha/2: = 2.700e+000Results for Alternative Hypothesis and alpha = 0.0500Alternative Hypothesis ConclusionStandard Deviation != 10.000 REJECTEDStandard Deviation < 10.000 REJECTEDStandard Deviation > 10.000 NOT REJECTED_____________________________________________________________Estimated sample sizes required for various confidence levels_____________________________________________________________True Variance = 100.00000Difference to detect = 95.16090_______________________________________________________________Confidence Estimated Estimated Value (%) Sample Size Sample Size (lower one- (upper one- sided test) sided test)_______________________________________________________________ 50.000 2 2 66.667 2 5 75.000 2 10 90.000 4 32 95.000 5 51 99.000 7 99 99.900 11 174 99.990 15 251 99.999 20 330_____________________________________________________________Estimated sample sizes required for various confidence levels_____________________________________________________________True Variance = 100.00000Difference to detect = 55.00000_______________________________________________________________Confidence Estimated Estimated Value (%) Sample Size Sample Size (lower one- (upper one- sided test) sided test)_______________________________________________________________ 50.000 2 2 66.667 4 10 75.000 8 21 90.000 23 71 95.000 36 115 99.000 71 228 99.900 123 401 99.990 177 580 99.999 232 762_____________________________________________________________Estimated sample sizes required for various confidence levels_____________________________________________________________True Variance = 100.00000Difference to detect = 1.00000_______________________________________________________________Confidence Estimated Estimated Value (%) Sample Size Sample Size (lower one- (upper one- sided test) sided test)_______________________________________________________________ 50.000 2 2 66.667 14696 14993 75.000 36033 36761 90.000 130079 132707 95.000 214283 218612 99.000 428628 437287 99.900 756333 771612 99.990 1095435 1117564 99.999 1440608 1469711________________________________________________2-Sided Confidence Limits For Standard Deviation________________________________________________Confidence level (two-sided) = 0.1000000Standard Deviation = 1.0000000_____________________________________________Observations Lower Upper Limit Limit_____________________________________________ 2 0.5102 15.9472 3 0.5778 4.4154 4 0.6196 2.9200 5 0.6493 2.3724 6 0.6720 2.0893 7 0.6903 1.9154 8 0.7054 1.7972 9 0.7183 1.7110 10 0.7293 1.6452 15 0.7688 1.4597 20 0.7939 1.3704 30 0.8255 1.2797 40 0.8454 1.2320 50 0.8594 1.2017 60 0.8701 1.1805 100 0.8963 1.1336 120 0.9045 1.1203 1000 0.9646 1.0383 10000 0.9885 1.0118 50000 0.9948 1.0052 100000 0.9963 1.0037 1000000 0.9988 1.0012________________________________________________2-Sided Confidence Limits For Standard Deviation________________________________________________Confidence level (two-sided) = 0.0500000Standard Deviation = 1.0000000_____________________________________________Observations Lower Upper Limit Limit_____________________________________________ 2 0.4461 31.9102 3 0.5207 6.2847 4 0.5665 3.7285 5 0.5991 2.8736 6 0.6242 2.4526 7 0.6444 2.2021 8 0.6612 2.0353 9 0.6755 1.9158 10 0.6878 1.8256 15 0.7321 1.5771 20 0.7605 1.4606 30 0.7964 1.3443 40 0.8192 1.2840 50 0.8353 1.2461 60 0.8476 1.2197 100 0.8780 1.1617 120 0.8875 1.1454 1000 0.9580 1.0459 10000 0.9863 1.0141 50000 0.9938 1.0062 100000 0.9956 1.0044 1000000 0.9986 1.0014________________________________________________2-Sided Confidence Limits For Standard Deviation________________________________________________Confidence level (two-sided) = 0.0100000Standard Deviation = 1.0000000_____________________________________________Observations Lower Upper Limit Limit_____________________________________________ 2 0.3562 159.5759 3 0.4344 14.1244 4 0.4834 6.4675 5 0.5188 4.3960 6 0.5464 3.4848 7 0.5688 2.9798 8 0.5875 2.6601 9 0.6036 2.4394 10 0.6177 2.2776 15 0.6686 1.8536 20 0.7018 1.6662 30 0.7444 1.4867 40 0.7718 1.3966 50 0.7914 1.3410 60 0.8065 1.3026 100 0.8440 1.2200 120 0.8558 1.1973 1000 0.9453 1.0609 10000 0.9821 1.0185 50000 0.9919 1.0082 100000 0.9943 1.0058 1000000 0.9982 1.0018*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -