Hermann Norpois
2014-Mar-27 13:14 UTC
completely different results for shapiro.test and ks.test
Hello, My main question is wheter my data is distributed normally. As the shapiro.test doesnt work for large data sets I prefer the ks.test. But I have some problems to understand the completely different p-values: > ks.test (test, pnorm, mean (test), sd (test)) One-sample Kolmogorov-Smirnov test data: test D = 0.0434, p-value = 0.1683 alternative hypothesis: two-sided Warnmeldung: In ks.test(test, pnorm, mean(test), sd(test)) : für den Komogorov-Smirnov-Test sollten keine Bindungen vorhanden sein> shapiro.test (test)Shapiro-Wilk normality test data: test W = 0.9694, p-value = 1.778e-10 Generating some random data the difference is acceptable:> nt <- rnorm (200, mean=5, sd=1) > ks.test (nt, pnorm, mean=5, sd=1)One-sample Kolmogorov-Smirnov test data: nt D = 0.0641, p-value = 0.3841 alternative hypothesis: two-sided> shapiro.test (nt)Shapiro-Wilk normality test data: nt W = 0.9933, p-value = 0.5045 Thanks hermann> dput (test)c(249, 62, 165, 333, 261, 184, 208, 76, 124, 177, 113, 224, 171, 193, 105, 309, 182, 291, 154, 148, 94, 51, 277, 204, 171, 129, 303, 112, 185, 140, 60, 228, 330, 226, 281, 191, 164, 223, 139, 103, 209, 99, 83, 167, 273, 101, 96, 142, 90, 107, 122, 135, 106, 72, 139, 77, 113, 86, 233, 318.5, 190, 202, 214, 282, 141, 225, 128, 206, 128, 125, 220, 187, 208, 169, 244, 167, 354, 257, 74, 386, 151, 189, 289, 109, 114, 244, 326, 171, 179, 179, 229, 107, 279, 94, 259, 188, 105, 149, 246, 103, 282, 292, 112, 207, 93, 94, 291, 213, 200, 221, 190, 245, 190, 230, 260, 182, 125, 61, 188.4, 131, 227, 227, 223, 147, 179, 146, 162, 198, 266, 156, 157, 146, 121, 207, 191, 138.8, 119, 252.5, 224, 145, 190, 94, 172, 122, 167, 202, 157, 223, 263, 191, 86, 142, 271, 246, 182, 152, 261, 168, 172, 274, 159, 121, 206, 241, 226, 312, 107, 167, 215, 203, 207, 158, 241, 114, 264, 48, 174, 219, 263, 224, 120, 173.2, 101.2, 217, 217.1, 174, 233.5, 160, 255, 205, 190, 124, 168.8, 159.2, 317.6, 174, 97.34, 102.4, 200.6, 149.1, 235.1, 143.6, 156.9, 94.4, 216.8, 406.2, 300, 195, 196.1, 163.4, 233.7, 133, 197.5, 162.1, 390.6, 224.4, 84.17, 246.5, 258.5, 147, 96.94, 163.2, 173.9, 170.1, 134.5, 208.6, 91.19, 219.6, 128.3, 579.2, 226.8, 184.8, 61.77, 139.6, 198.7, 158.9, 169.7, 195.6, 181.7, 254.5, 130, 194.3, 280.4, 260, 192.5, 174.1, 263, 173.5, 324.6, 227.7, 267.8, 215.1, 219.5, 295.8, 92.37, 157.5, 69.94, 198.3, 148.5, 243.6, 160.4, 121.5, 101.2, 197.3, 207.9, 256.9, 222, 121, 204.9, 132, 260.6, 199.8, 79.49, 417.6, 234.3, 222.9, 178.5, 237, 132.9, 173.5, 215.9, 113.2, 123.2, 159.2, 154.2, 249.5, 299.3, 243.5, 144.7, 169.1, 184.9, 237.1, 143.8, 228, 177.5, 201.6, 299.1, 211.3, 157.5, 241.3, 150, 206.8, 190.3, 198.1, 197, 113.9, 190.3, 241.1, 107.5, 166.1, 232.2, 319.3, 170.8, 180.1, 257.9, 98.1, 254, 269.2, 127.9, 191.1, 110.3, 161.7, 108.7, 160.8, 187, 168.3, 208.9, 181.6, 183.2, 152.5, 115.4, 189.4, 199.9, 154.6, 116, 158, 144.4, 206.8, 231.2, 132.9, 131.9, 84.66, 214.9, 67.51, 205.2, 171, 91.57, 194.1, 334.3, 147.1, 202.8, 166, 297, 195.4, 117.9, 126.9, 245.4, 243.1, 249.3, 236, 216.5, 201, 103.5, 122.1, 195, 227.9, 174.4, 274, 167.1, 137, 198.8, 140.6, 161.8, 231.3, 184.3, 169.9, 220.5, 409.3, 321.5, 225.7, 225.2, 207, 155.6, 239.8, 136.4, 181.2, 169.1, 179.4, 118, 104.4, 303.1, 243.4, 194.4, 170.4, 113.4, 256.1, 145.4, 456.9, 233.9, 249.3, 150.7, 227.9, 220.2, 222.1, 209.4, 218.6, 191.7, 139.9, 131.8, 160.7, 143.1, 240, 70.22, 189.3, 332.3, 257.8, 185.5, 96.4, 187.1, 273.7, 213.3, 314.9, 110.4, 191.1, 243.4, 178.3, 209.7, 120.5, 269.6, 169.9, 292, 283.6, 302.2, 273, 229.6, 191.8, 153.2, 113.8, 159.5, 137.4, 261.4, 93.84, 244.9, 101.6, 153.8, 266.3, 170.3, 322.5, 190.8, 258.3, 222.5, 107.5, 315.8, 248.4, 161.4, 250.5, 302.2, 333.5, 161, 107.4, 104.2, 175.3, 98.96, 100.5, 247.7, 196.7, 306.4, 229.6, 92.97, 287.2, 320.2, 236.1, 296.9, 206.4, 282, 233.6, 217.9, 220.9, 177, 128.8, 257.7, 236.1, 209.5, 235, 387.1, 244.7, 249.2, 181.4, 179, 236.8, 160, 204.3, 108.1, 484.9, 227.9, 197.9, 292.2, 274, 200.8, 197.2, 246.2, 163.9, 173.7, 128, 98.27, 59.31, 432.5, 184.7, 217.6, 193.8, 379.1, 177.6, 304.4, 173.4, 227.4, 204.9, 173.6, 163.4, 189.2, 146.8, 165.5, 235.3, 99.92, 317.6, 198, 187.1, 93.61, 199.5, 264.3, 156.3, 287.4, 237.8, 183.6, 239.5, 169.5, 101.8, 176.7, 208.1, 223.3, 324, 205.3, 183.3, 275.8, 118.7, 202.6, 350.2, 255.8, 171.4, 275.6, 293.7, 173, 130.5, 319.7, 221.4, 107.6, 190.7, 422.6, 85.19, 244.8, 155.9, 184.7, 175.1, 229.4, 128.5, 105.7, 191.7, 322.9, 253.5, 195.1, 96.9, 189, 302.9, 297.8, 191.5, 284.6, 244.3, 100.4, 151.3, 196.9, 283, 170.7, 216, 108, 159, 167.4, 175.3, 192.1, 184.3, 244.4, 201.9, 146.1, 270.4, 386.7, 214.3, 240, 139, 393, 68.64, 283.4, 300.2, 228.8, 213.4, 215.1, 164.3, 214.1, 164.9, 233.1, 173.2, 182.5, 105.7, 333.7, 152.2, 143, 258.7, 213, 267.5, 149.4, 132.3, 153.4, 190.1, 167, 52.83, 179.9, 302.3, 251, 165.4, 176.6, 201.5, 93.25, 182.3, 230, 301.2, 159.2, 166.4, 189.2, 139.3, 221.8, 243.8, 129.7, 228.6, 287.8, 210.7, 233.4, 154.8, 34.94, 171.8, 197.9, 217.5, 176.3, 64.26, 140.3, 140.4, 213.1, 121.5, 142.8, 190, 252.1)>[[alternative HTML version deleted]]