R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i386-pc-mingw32/i386 (32-bit) R -- это свободное ПО, и оно поставляется безо всяких гарантий. Вы вольны распространять его при соблюдении некоторых условий. Введите 'license()' для получения более подробной информации. R -- это проект, в котором сотрудничает множество разработчиков. Введите 'contributors()' для получения дополнительной информации и 'citation()' для ознакомления с правилами упоминания R и его пакетов в публикациях. Введите 'demo()' для запуска демонстрационных программ, 'help()' -- для получения справки, 'help.start()' -- для доступа к справке через браузер. Введите 'q()', чтобы выйти из R. > trees Girth Height Volume 1 8.3 70 10.3 2 8.6 65 10.3 3 8.8 63 10.2 4 10.5 72 16.4 5 10.7 81 18.8 6 10.8 83 19.7 7 11.0 66 15.6 8 11.0 75 18.2 9 11.1 80 22.6 10 11.2 75 19.9 11 11.3 79 24.2 12 11.4 76 21.0 13 11.4 76 21.4 14 11.7 69 21.3 15 12.0 75 19.1 16 12.9 74 22.2 17 12.9 85 33.8 18 13.3 86 27.4 19 13.7 71 25.7 20 13.8 64 24.9 21 14.0 78 34.5 22 14.2 80 31.7 23 14.5 74 36.3 24 16.0 72 38.3 25 16.3 77 42.6 26 17.3 81 55.4 27 17.5 82 55.7 28 17.9 80 58.3 29 18.0 80 51.5 30 18.0 80 51.0 31 20.6 87 77.0 > ?trees starting httpd help server ... done > names(trees) [1] "Girth" "Height" "Volume" > ?trees > summary(trees) Girth Height Volume Min. : 8.30 Min. :63 Min. :10.20 1st Qu.:11.05 1st Qu.:72 1st Qu.:19.40 Median :12.90 Median :76 Median :24.20 Mean :13.25 Mean :76 Mean :30.17 3rd Qu.:15.25 3rd Qu.:80 3rd Qu.:37.30 Max. :20.60 Max. :87 Max. :77.00 > attenu event mag station dist accel 1 1 7.0 117 12.0 0.359 2 2 7.4 1083 148.0 0.014 3 2 7.4 1095 42.0 0.196 4 2 7.4 283 85.0 0.135 5 2 7.4 135 107.0 0.062 6 2 7.4 475 109.0 0.054 7 2 7.4 113 156.0 0.014 8 2 7.4 1008 224.0 0.018 9 2 7.4 1028 293.0 0.010 10 2 7.4 2001 359.0 0.004 11 2 7.4 117 370.0 0.004 12 3 5.3 1117 8.0 0.127 13 4 6.1 1438 16.1 0.411 14 4 6.1 1083 63.6 0.018 15 4 6.1 1013 6.6 0.509 16 4 6.1 1014 9.3 0.467 17 4 6.1 1015 13.0 0.279 18 4 6.1 1016 17.3 0.072 19 4 6.1 1095 105.0 0.012 20 4 6.1 1011 112.0 0.006 21 4 6.1 1028 123.0 0.003 22 5 6.6 270 105.0 0.018 23 5 6.6 280 122.0 0.048 24 5 6.6 116 141.0 0.011 25 5 6.6 266 200.0 0.007 26 5 6.6 117 45.0 0.142 27 5 6.6 113 130.0 0.031 28 5 6.6 112 147.0 0.006 29 5 6.6 130 187.0 0.010 30 5 6.6 475 197.0 0.010 31 5 6.6 269 203.0 0.006 32 5 6.6 135 211.0 0.013 33 6 5.6 1093 62.0 0.005 34 7 5.7 1093 62.0 0.003 35 8 5.3 111 19.0 0.086 36 8 5.3 116 21.0 0.179 37 8 5.3 290 13.0 0.205 38 8 5.3 112 22.0 0.073 39 8 5.3 113 29.0 0.045 40 9 6.6 128 17.0 0.374 41 9 6.6 126 19.6 0.200 42 9 6.6 127 20.2 0.147 43 9 6.6 141 21.1 0.188 44 9 6.6 266 21.9 0.204 45 9 6.6 110 24.2 0.335 46 9 6.6 1027 66.0 0.057 47 9 6.6 111 87.0 0.021 48 9 6.6 125 23.4 0.152 49 9 6.6 135 24.6 0.217 50 9 6.6 475 25.7 0.114 51 9 6.6 262 28.6 0.150 52 9 6.6 269 37.4 0.148 53 9 6.6 1052 46.7 0.112 54 9 6.6 411 56.9 0.043 55 9 6.6 290 60.7 0.057 56 9 6.6 130 61.4 0.030 57 9 6.6 272 62.0 0.027 58 9 6.6 1096 64.0 0.028 59 9 6.6 1102 82.0 0.034 60 9 6.6 112 88.0 0.030 61 9 6.6 113 91.0 0.039 62 10 5.3 1028 31.0 0.030 63 11 7.7 2714 45.0 0.110 64 11 7.7 2708 145.0 0.010 65 11 7.7 2715 300.0 0.010 66 12 6.2 3501 5.0 0.390 67 13 5.6 655 50.0 0.031 68 13 5.6 272 16.0 0.130 69 14 5.2 1032 17.0 0.011 70 14 5.2 1377 8.0 0.120 71 14 5.2 1028 10.0 0.170 72 14 5.2 1250 10.0 0.140 73 15 6.0 1051 8.0 0.110 74 15 6.0 1293 32.0 0.040 75 15 6.0 1291 30.0 0.070 76 15 6.0 1292 31.0 0.080 77 16 5.1 283 2.9 0.210 78 16 5.1 885 3.2 0.390 79 16 5.1 7.6 0.280 80 17 7.6 2734 25.4 0.160 81 17 7.6 32.9 0.064 82 17 7.6 2728 92.2 0.090 83 18 5.8 1413 1.2 0.420 84 18 5.8 1445 1.6 0.230 85 18 5.8 1408 9.1 0.130 86 18 5.8 1411 3.7 0.260 87 18 5.8 1410 5.3 0.270 88 18 5.8 1409 7.4 0.260 89 18 5.8 1377 17.9 0.110 90 18 5.8 1492 19.2 0.120 91 18 5.8 1251 23.4 0.038 92 18 5.8 1422 30.0 0.044 93 18 5.8 1376 38.9 0.046 94 19 6.5 23.5 0.170 95 19 6.5 286 26.0 0.210 96 19 6.5 0.5 0.320 97 19 6.5 5028 0.6 0.520 98 19 6.5 942 1.3 0.720 99 19 6.5 1.4 0.320 100 19 6.5 5054 2.6 0.810 101 19 6.5 958 3.8 0.640 102 19 6.5 952 4.0 0.560 103 19 6.5 5165 5.1 0.510 104 19 6.5 117 6.2 0.400 105 19 6.5 955 6.8 0.610 106 19 6.5 5055 7.5 0.260 107 19 6.5 7.6 0.240 108 19 6.5 8.4 0.460 109 19 6.5 5060 8.5 0.220 110 19 6.5 412 8.5 0.230 111 19 6.5 5053 10.6 0.280 112 19 6.5 5058 12.6 0.380 113 19 6.5 5057 12.7 0.270 114 19 6.5 12.9 0.310 115 19 6.5 5051 14.0 0.200 116 19 6.5 15.0 0.110 117 19 6.5 5115 16.0 0.430 118 19 6.5 17.7 0.270 119 19 6.5 931 18.0 0.150 120 19 6.5 5056 22.0 0.150 121 19 6.5 5059 22.0 0.150 122 19 6.5 5061 23.0 0.130 123 19 6.5 23.2 0.190 124 19 6.5 5062 29.0 0.130 125 19 6.5 5052 32.0 0.066 126 19 6.5 32.7 0.350 127 19 6.5 724 36.0 0.100 128 19 6.5 43.5 0.160 129 19 6.5 5066 49.0 0.140 130 19 6.5 5050 60.0 0.049 131 19 6.5 2316 64.0 0.034 132 20 5.0 5055 7.5 0.264 133 20 5.0 942 8.8 0.263 134 20 5.0 5028 8.9 0.230 135 20 5.0 5165 9.4 0.147 136 20 5.0 952 9.7 0.286 137 20 5.0 958 9.7 0.157 138 20 5.0 955 10.5 0.237 139 20 5.0 117 10.5 0.133 140 20 5.0 412 12.0 0.055 141 20 5.0 5053 12.2 0.097 142 20 5.0 5054 12.8 0.129 143 20 5.0 5058 14.6 0.192 144 20 5.0 5057 14.9 0.147 145 20 5.0 5115 17.6 0.154 146 20 5.0 5056 23.9 0.060 147 20 5.0 5060 25.0 0.057 148 21 5.8 1030 10.8 0.120 149 21 5.8 1418 15.7 0.154 150 21 5.8 1383 16.7 0.052 151 21 5.8 1308 20.8 0.045 152 21 5.8 1298 28.5 0.086 153 21 5.8 1299 33.1 0.056 154 21 5.8 1219 40.3 0.065 155 22 5.5 4.0 0.259 156 22 5.5 10.1 0.267 157 22 5.5 1030 11.1 0.071 158 22 5.5 1418 17.7 0.275 159 22 5.5 1383 22.5 0.058 160 22 5.5 26.5 0.026 161 22 5.5 1299 29.0 0.039 162 22 5.5 1308 30.9 0.112 163 22 5.5 1219 37.8 0.065 164 22 5.5 1456 48.3 0.026 165 23 5.3 5045 5.8 0.123 166 23 5.3 5044 12.0 0.133 167 23 5.3 5160 12.1 0.073 168 23 5.3 5043 20.5 0.097 169 23 5.3 5047 20.5 0.096 170 23 5.3 c168 25.3 0.230 171 23 5.3 5068 35.9 0.082 172 23 5.3 c118 36.1 0.110 173 23 5.3 5042 36.3 0.110 174 23 5.3 5067 38.5 0.094 175 23 5.3 5049 41.4 0.040 176 23 5.3 c204 43.6 0.050 177 23 5.3 5070 44.4 0.022 178 23 5.3 c266 46.1 0.070 179 23 5.3 c203 47.1 0.080 180 23 5.3 5069 47.7 0.033 181 23 5.3 5073 49.2 0.017 182 23 5.3 5072 53.1 0.022 > ?attenu > summary(attenu) event mag station dist accel Min. : 1.00 Min. :5.000 117 : 5 Min. : 0.50 Min. :0.00300 1st Qu.: 9.00 1st Qu.:5.300 1028 : 4 1st Qu.: 11.32 1st Qu.:0.04425 Median :18.00 Median :6.100 113 : 4 Median : 23.40 Median :0.11300 Mean :14.74 Mean :6.084 112 : 3 Mean : 45.60 Mean :0.15422 3rd Qu.:20.00 3rd Qu.:6.600 135 : 3 3rd Qu.: 47.55 3rd Qu.:0.21925 Max. :23.00 Max. :7.700 (Other):147 Max. :370.00 Max. :0.81000 NA's : 16 > plot(trees) > boxplot(trees) > ?boxplot > boxplot(trees, range = 0) > ?InsectSprays > boxplot(count ~ spray, data = InsectSprays, + xlab = "Type of spray", ylab = "Insect count", + main = "InsectSprays data", varwidth = TRUE, col = "lightgray" + ) > trees Girth Height Volume 1 8.3 70 10.3 2 8.6 65 10.3 3 8.8 63 10.2 4 10.5 72 16.4 5 10.7 81 18.8 6 10.8 83 19.7 7 11.0 66 15.6 8 11.0 75 18.2 9 11.1 80 22.6 10 11.2 75 19.9 11 11.3 79 24.2 12 11.4 76 21.0 13 11.4 76 21.4 14 11.7 69 21.3 15 12.0 75 19.1 16 12.9 74 22.2 17 12.9 85 33.8 18 13.3 86 27.4 19 13.7 71 25.7 20 13.8 64 24.9 21 14.0 78 34.5 22 14.2 80 31.7 23 14.5 74 36.3 24 16.0 72 38.3 25 16.3 77 42.6 26 17.3 81 55.4 27 17.5 82 55.7 28 17.9 80 58.3 29 18.0 80 51.5 30 18.0 80 51.0 31 20.6 87 77.0 > summary(trees) Girth Height Volume Min. : 8.30 Min. :63 Min. :10.20 1st Qu.:11.05 1st Qu.:72 1st Qu.:19.40 Median :12.90 Median :76 Median :24.20 Mean :13.25 Mean :76 Mean :30.17 3rd Qu.:15.25 3rd Qu.:80 3rd Qu.:37.30 Max. :20.60 Max. :87 Max. :77.00 > t.test(trees$Height, mu = 76) One Sample t-test data: trees$Height t = 0, df = 30, p-value = 1 alternative hypothesis: true mean is not equal to 76 95 percent confidence interval: 73.6628 78.3372 sample estimates: mean of x 76 > t.test(trees$Height, mu = 75) One Sample t-test data: trees$Height t = 0.8738, df = 30, p-value = 0.3892 alternative hypothesis: true mean is not equal to 75 95 percent confidence interval: 73.6628 78.3372 sample estimates: mean of x 76 > t.test(trees$Height, mu = 70) One Sample t-test data: trees$Height t = 5.2429, df = 30, p-value = 1.173e-05 alternative hypothesis: true mean is not equal to 70 95 percent confidence interval: 73.6628 78.3372 sample estimates: mean of x 76 > t.test(trees$Height, mu = 73) One Sample t-test data: trees$Height t = 2.6214, df = 30, p-value = 0.01362 alternative hypothesis: true mean is not equal to 73 95 percent confidence interval: 73.6628 78.3372 sample estimates: mean of x 76 > t.test(trees$Height, mu = 75) One Sample t-test data: trees$Height t = 0.8738, df = 30, p-value = 0.3892 alternative hypothesis: true mean is not equal to 75 95 percent confidence interval: 73.6628 78.3372 sample estimates: mean of x 76 > t.test(trees$Height, mu = 70) One Sample t-test data: trees$Height t = 5.2429, df = 30, p-value = 1.173e-05 alternative hypothesis: true mean is not equal to 70 95 percent confidence interval: 73.6628 78.3372 sample estimates: mean of x 76 > t.test(trees$Height, mu = 73) One Sample t-test data: trees$Height t = 2.6214, df = 30, p-value = 0.01362 alternative hypothesis: true mean is not equal to 73 95 percent confidence interval: 73.6628 78.3372 sample estimates: mean of x 76 > hist(trees$Height) > hist(trees$Height, breaks = 20) > hist(trees$Height, breaks = 10) > hist(trees$Height, breaks = 5) > hist(trees$Height) > ?hist > wilcox.test(trees$Height, mu = 76) Wilcoxon signed rank test with continuity correction data: trees$Height V = 225.5, p-value = 0.8709 alternative hypothesis: true location is not equal to 76 Предупреждения 1: In wilcox.test.default(trees$Height, mu = 76) : не могу подсчитать точное p-значение при наличии повторяющихся наблюдений 2: In wilcox.test.default(trees$Height, mu = 76) : не могу высчитать точное p-значение при наличии нулей > table(trees$Height) 63 64 65 66 69 70 71 72 74 75 76 77 78 79 80 81 82 83 85 86 87 1 1 1 1 1 1 1 2 2 3 2 1 1 1 5 2 1 1 1 1 1 > wilcox.test(trees$Height, mu = 76) Wilcoxon signed rank test with continuity correction data: trees$Height V = 225.5, p-value = 0.8709 alternative hypothesis: true location is not equal to 76 Предупреждения 1: In wilcox.test.default(trees$Height, mu = 76) : не могу подсчитать точное p-значение при наличии повторяющихся наблюдений 2: In wilcox.test.default(trees$Height, mu = 76) : не могу высчитать точное p-значение при наличии нулей > ?wilcox.test > wilcox.test(trees$Height, mu = 76, exact = TRUE) Wilcoxon signed rank test with continuity correction data: trees$Height V = 225.5, p-value = 0.8709 alternative hypothesis: true location is not equal to 76 Предупреждения 1: In wilcox.test.default(trees$Height, mu = 76, exact = TRUE) : не могу подсчитать точное p-значение при наличии повторяющихся наблюдений 2: In wilcox.test.default(trees$Height, mu = 76, exact = TRUE) : не могу высчитать точное p-значение при наличии нулей > wilcox.test(trees$Height, mu = 76, exact = TRUE, cont = FALSE) Wilcoxon signed rank test with continuity correction data: trees$Height V = 225.5, p-value = 0.8709 alternative hypothesis: true location is not equal to 76 Предупреждения 1: In wilcox.test.default(trees$Height, mu = 76, exact = TRUE, cont = FALSE) : не могу подсчитать точное p-значение при наличии повторяющихся наблюдений 2: In wilcox.test.default(trees$Height, mu = 76, exact = TRUE, cont = FALSE) : не могу высчитать точное p-значение при наличии нулей > table(trees$Volume) 10.2 10.3 15.6 16.4 18.2 18.8 19.1 19.7 19.9 21 21.3 21.4 22.2 22.6 24.2 24.9 25.7 27.4 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 31.7 33.8 34.5 36.3 38.3 42.6 51 51.5 55.4 55.7 58.3 77 1 1 1 1 1 1 1 1 1 1 1 1 > table(subset(InsectSprays, spray = 7)) spray count A B C D E F 0 0 0 2 0 0 0 1 0 0 4 0 2 0 2 0 0 2 1 1 0 3 0 0 2 2 4 0 4 0 0 1 2 1 0 5 0 0 0 5 2 0 6 0 0 0 1 2 0 7 1 1 1 0 0 0 9 0 0 0 0 0 1 10 2 0 0 0 0 1 11 0 2 0 0 0 1 12 1 0 0 1 0 0 13 1 1 0 0 0 2 14 3 1 0 0 0 0 15 0 0 0 0 0 2 16 0 1 0 0 0 1 17 1 3 0 0 0 0 19 0 1 0 0 0 0 20 2 0 0 0 0 0 21 0 2 0 0 0 0 22 0 0 0 0 0 1 23 1 0 0 0 0 0 24 0 0 0 0 0 1 26 0 0 0 0 0 2 > wilcox.test(rnorm(50), mu = 0)) Ошибка: неожиданный ')' в "wilcox.test(rnorm(50), mu = 0))" > wilcox.test(rnorm(50), mu = 0) Wilcoxon signed rank test with continuity correction data: rnorm(50) V = 794, p-value = 0.1321 alternative hypothesis: true location is not equal to 0 > wilcox.test(rnorm(50), mu = 0, conf.int = TRUE) Wilcoxon signed rank test with continuity correction data: rnorm(50) V = 599, p-value = 0.7137 alternative hypothesis: true location is not equal to 0 95 percent confidence interval: -0.3156951 0.2577714 sample estimates: (pseudo)median -0.04531557 > rnorm(50) [1] -1.06872535 -0.16961729 -0.06104950 1.07148042 -0.29014359 0.80589742 -0.97225975 [8] -0.36809672 -1.88911738 0.98484018 -0.99632733 1.97263293 -0.43628217 0.76815143 [15] -0.83011785 1.81269396 1.77964052 0.17990655 -0.56915900 -2.45560880 -2.29533838 [22] 0.71546187 0.74459084 2.21562744 1.45401075 -1.73394255 -0.59718469 0.36209304 [29] -0.26999558 1.33393639 1.91426788 -0.48397011 -1.65606526 0.46885020 0.41710736 [36] -0.05037573 0.81734713 0.87954154 -0.61535783 0.29209809 0.50695030 -0.07642135 [43] -1.27056141 0.21760728 1.05175135 0.81211303 1.25114938 0.21264591 -1.57843134 [50] -0.88708122 > wilcox.test(rnorm(50), mu = 0, conf.int = TRUE) Wilcoxon signed rank test with continuity correction data: rnorm(50) V = 599, p-value = 0.7137 alternative hypothesis: true location is not equal to 0 95 percent confidence interval: -0.3383741 0.2697332 sample estimates: (pseudo)median -0.03510439 > set.seed(10) > wilcox.test(rnorm(50), mu = 0, conf.int = TRUE) Wilcoxon signed rank test with continuity correction data: rnorm(50) V = 390, p-value = 0.01711 alternative hypothesis: true location is not equal to 0 95 percent confidence interval: -0.59315561 -0.06560152 sample estimates: (pseudo)median -0.3198793 > set.seed(10) > wilcox.test(rnorm(50), mu = 0, conf.int = TRUE) Wilcoxon signed rank test with continuity correction data: rnorm(50) V = 390, p-value = 0.01711 alternative hypothesis: true location is not equal to 0 95 percent confidence interval: -0.59315561 -0.06560152 sample estimates: (pseudo)median -0.3198793 > set.seed(50) > wilcox.test(rnorm(50), mu = 0, conf.int = TRUE) Wilcoxon signed rank test with continuity correction data: rnorm(50) V = 552, p-value = 0.4119 alternative hypothesis: true location is not equal to 0 95 percent confidence interval: -0.3877343 0.1159773 sample estimates: (pseudo)median -0.1130781 > wilcox.test(rnorm(50), mu = 10, conf.int = TRUE) Wilcoxon signed rank test with continuity correction data: rnorm(50) V = 0, p-value = 7.79e-10 alternative hypothesis: true location is not equal to 10 95 percent confidence interval: -0.3947469 0.2208125 sample estimates: (pseudo)median -0.07993585 > wilcox.test(rnorm(50), mu = 10) Wilcoxon signed rank test with continuity correction data: rnorm(50) V = 0, p-value = 7.79e-10 alternative hypothesis: true location is not equal to 10 > wilcox.test(rnorm(50), mu = 10, conf.int = TRUE) Wilcoxon signed rank test with continuity correction data: rnorm(50) V = 0, p-value = 7.79e-10 alternative hypothesis: true location is not equal to 10 95 percent confidence interval: -0.2278853 0.3565903 sample estimates: (pseudo)median 0.05200034 > qqnorm(trees$Height) > qqline(trees$Height) > qqnorm(rexp(50)) > v<-rexp(50) > qqnorm(v) > qqline(v) > shapiro.test(trees$Height) Shapiro-Wilk normality test data: trees$Height W = 0.9655, p-value = 0.4034 > shapiro.test(v) Shapiro-Wilk normality test data: v W = 0.7852, p-value = 4.057e-07 > shapiro.test(rexp(30)) Shapiro-Wilk normality test data: rexp(30) W = 0.8701, p-value = 0.001688 > shapiro.test(rexp(20)) Shapiro-Wilk normality test data: rexp(20) W = 0.8454, p-value = 0.004473 > shapiro.test(rexp(10)) Shapiro-Wilk normality test data: rexp(10) W = 0.8241, p-value = 0.02841 > shapiro.test(rt(10, df = 40)) Shapiro-Wilk normality test data: rt(10, df = 40) W = 0.98, p-value = 0.9654 > shapiro.test(rt(100, df = 40)) Shapiro-Wilk normality test data: rt(100, df = 40) W = 0.9897, p-value = 0.6372 > shapiro.test(rt(1000, df = 40)) Shapiro-Wilk normality test data: rt(1000, df = 40) W = 0.9984, p-value = 0.4654 > shapiro.test(rt(10000, df = 40)) Ошибка в shapiro.test(rt(10000, df = 40)) : размер выборки должен быть между 3 и 5000 > shapiro.test(rt(5000, df = 40)) Shapiro-Wilk normality test data: rt(5000, df = 40) W = 0.9996, p-value = 0.3368 > rbinom(2) Ошибка в .Internal(rbinom(n, size, prob)) : 'size' отсутствует > rbinom(2, size = 1) Ошибка в .Internal(rbinom(n, size, prob)) : 'prob' отсутствует > rbinom(2, size = 1, prob = 0.5) [1] 1 0 > v <- 2*(rbinom(100, size = 1, prob = 0.5)-0.5)*rexp(100) > v [1] -1.052487217 1.100712292 1.227905996 -0.846505535 1.043492416 -0.157793446 [7] 0.106399795 0.391432311 -1.396848302 -0.711694602 -0.426445899 -0.102993448 [13] -3.337447911 1.440425999 0.201473244 -2.549114765 7.125560591 -0.862885448 [19] 0.334190238 1.458281442 -0.923989940 -1.108472052 1.692945145 1.900038810 [25] 0.559256009 0.635424445 -0.578740043 2.990233689 1.264674620 -0.976982201 [31] -0.231999072 0.224837049 -0.994532634 0.008021813 0.627675818 -0.559725486 [37] 0.137040116 -0.603706990 -1.605399881 0.236938784 -1.049619103 -1.157287981 [43] -0.009209246 0.097431650 -1.188066710 1.802931392 0.280945204 -0.961384974 [49] 1.415333439 0.064131589 -0.740770836 -0.354551285 -0.168081315 0.933159833 [55] 1.272596475 0.041328711 -0.009777530 -0.177500522 -0.028462498 2.763176313 [61] -1.600498240 2.279982390 -0.022584710 -0.110712133 0.129516501 0.869519509 [67] -1.301959638 -0.799340203 0.091319279 -0.052105814 0.502107635 0.801389125 [73] 0.584585215 1.095900615 2.225240650 0.610394098 3.019922873 -0.331495772 [79] 1.013639600 -0.071211275 1.592684207 0.256116895 -0.133616879 -1.190372639 [85] -0.221774090 -0.320756370 -2.114722254 1.434265468 -0.535385848 -2.156901350 [91] 2.410315996 1.158031918 2.102323031 -0.257855758 -0.119121013 1.279847108 [97] 0.035672986 -1.445381139 1.460573907 -0.586092243 > hist(v) > shapiro.test(v) Shapiro-Wilk normality test data: v W = 0.9241, p-value = 2.337e-05 > qqnorm(v) > qqline(v) > v1 <- v[v< 7] > hist(v1) > qqnorm(v1) > qqline(v1) > shapiro.test(v1) Shapiro-Wilk normality test data: v1 W = 0.9875, p-value = 0.4827 > ?sleep > summary(sleep) extra group ID Min. :-1.600 1:10 1 :2 1st Qu.:-0.025 2:10 2 :2 Median : 0.950 3 :2 Mean : 1.540 4 :2 3rd Qu.: 3.400 5 :2 Max. : 5.500 6 :2 (Other):8 > plot(extra ~ group, data = sleep) > with(sleep, t.test(extra[group == 1], extra[group == 2])) Welch Two Sample t-test data: extra[group == 1] and extra[group == 2] t = -1.8608, df = 17.776, p-value = 0.07939 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -3.3654832 0.2054832 sample estimates: mean of x mean of y 0.75 2.33 > with(sleep, t.test(extra[group == 1], extra[group == 2], var.equal = TRUE)) Two Sample t-test data: extra[group == 1] and extra[group == 2] t = -1.8608, df = 18, p-value = 0.07919 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -3.363874 0.203874 sample estimates: mean of x mean of y 0.75 2.33 > with(sleep, t.test(extra[group == 1], extra[group == 2], paired = TRUE)) Paired t-test data: extra[group == 1] and extra[group == 2] t = -4.0621, df = 9, p-value = 0.002833 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -2.4598858 -0.7001142 sample estimates: mean of the differences -1.58 > sleep extra group ID 1 0.7 1 1 2 -1.6 1 2 3 -0.2 1 3 4 -1.2 1 4 5 -0.1 1 5 6 3.4 1 6 7 3.7 1 7 8 0.8 1 8 9 0.0 1 9 10 2.0 1 10 11 1.9 2 1 12 0.8 2 2 13 1.1 2 3 14 0.1 2 4 15 -0.1 2 5 16 4.4 2 6 17 5.5 2 7 18 1.6 2 8 19 4.6 2 9 20 3.4 2 10 > with(sleep, t.test(extra[group == 1], extra[group == 2], paired = TRUE)) Paired t-test data: extra[group == 1] and extra[group == 2] t = -4.0621, df = 9, p-value = 0.002833 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -2.4598858 -0.7001142 sample estimates: mean of the differences -1.58 > with(sleep, var.test(extra[group == 1], extra[group == 2])) F test to compare two variances data: extra[group == 1] and extra[group == 2] F = 0.7983, num df = 9, denom df = 9, p-value = 0.7427 alternative hypothesis: true ratio of variances is not equal to 1 95 percent confidence interval: 0.198297 3.214123 sample estimates: ratio of variances 0.7983426 > with(sleep, wilcox.test(extra[group == 1], extra[group == 2])) Wilcoxon rank sum test with continuity correction data: extra[group == 1] and extra[group == 2] W = 25.5, p-value = 0.06933 alternative hypothesis: true location shift is not equal to 0 Предупреждение In wilcox.test.default(extra[group == 1], extra[group == 2]) : cannot compute exact p-value with ties > with(sleep, wilcox.test(extra[group == 1], extra[group == 2], paired = TRUE)) Wilcoxon signed rank test with continuity correction data: extra[group == 1] and extra[group == 2] V = 0, p-value = 0.009091 alternative hypothesis: true location shift is not equal to 0 Предупреждения 1: In wilcox.test.default(extra[group == 1], extra[group == 2], paired = TRUE) : cannot compute exact p-value with ties 2: In wilcox.test.default(extra[group == 1], extra[group == 2], paired = TRUE) : cannot compute exact p-value with zeroes > airquality Ozone Solar.R Wind Temp Month Day 1 41 190 7.4 67 5 1 2 36 118 8.0 72 5 2 3 12 149 12.6 74 5 3 4 18 313 11.5 62 5 4 5 NA NA 14.3 56 5 5 6 28 NA 14.9 66 5 6 7 23 299 8.6 65 5 7 8 19 99 13.8 59 5 8 9 8 19 20.1 61 5 9 10 NA 194 8.6 69 5 10 11 7 NA 6.9 74 5 11 12 16 256 9.7 69 5 12 13 11 290 9.2 66 5 13 14 14 274 10.9 68 5 14 15 18 65 13.2 58 5 15 16 14 334 11.5 64 5 16 17 34 307 12.0 66 5 17 18 6 78 18.4 57 5 18 19 30 322 11.5 68 5 19 20 11 44 9.7 62 5 20 21 1 8 9.7 59 5 21 22 11 320 16.6 73 5 22 23 4 25 9.7 61 5 23 24 32 92 12.0 61 5 24 25 NA 66 16.6 57 5 25 26 NA 266 14.9 58 5 26 27 NA NA 8.0 57 5 27 28 23 13 12.0 67 5 28 29 45 252 14.9 81 5 29 30 115 223 5.7 79 5 30 31 37 279 7.4 76 5 31 32 NA 286 8.6 78 6 1 33 NA 287 9.7 74 6 2 34 NA 242 16.1 67 6 3 35 NA 186 9.2 84 6 4 36 NA 220 8.6 85 6 5 37 NA 264 14.3 79 6 6 38 29 127 9.7 82 6 7 39 NA 273 6.9 87 6 8 40 71 291 13.8 90 6 9 41 39 323 11.5 87 6 10 42 NA 259 10.9 93 6 11 43 NA 250 9.2 92 6 12 44 23 148 8.0 82 6 13 45 NA 332 13.8 80 6 14 46 NA 322 11.5 79 6 15 47 21 191 14.9 77 6 16 48 37 284 20.7 72 6 17 49 20 37 9.2 65 6 18 50 12 120 11.5 73 6 19 51 13 137 10.3 76 6 20 52 NA 150 6.3 77 6 21 53 NA 59 1.7 76 6 22 54 NA 91 4.6 76 6 23 55 NA 250 6.3 76 6 24 56 NA 135 8.0 75 6 25 57 NA 127 8.0 78 6 26 58 NA 47 10.3 73 6 27 59 NA 98 11.5 80 6 28 60 NA 31 14.9 77 6 29 61 NA 138 8.0 83 6 30 62 135 269 4.1 84 7 1 63 49 248 9.2 85 7 2 64 32 236 9.2 81 7 3 65 NA 101 10.9 84 7 4 66 64 175 4.6 83 7 5 67 40 314 10.9 83 7 6 68 77 276 5.1 88 7 7 69 97 267 6.3 92 7 8 70 97 272 5.7 92 7 9 71 85 175 7.4 89 7 10 72 NA 139 8.6 82 7 11 73 10 264 14.3 73 7 12 74 27 175 14.9 81 7 13 75 NA 291 14.9 91 7 14 76 7 48 14.3 80 7 15 77 48 260 6.9 81 7 16 78 35 274 10.3 82 7 17 79 61 285 6.3 84 7 18 80 79 187 5.1 87 7 19 81 63 220 11.5 85 7 20 82 16 7 6.9 74 7 21 83 NA 258 9.7 81 7 22 84 NA 295 11.5 82 7 23 85 80 294 8.6 86 7 24 86 108 223 8.0 85 7 25 87 20 81 8.6 82 7 26 88 52 82 12.0 86 7 27 89 82 213 7.4 88 7 28 90 50 275 7.4 86 7 29 91 64 253 7.4 83 7 30 92 59 254 9.2 81 7 31 93 39 83 6.9 81 8 1 94 9 24 13.8 81 8 2 95 16 77 7.4 82 8 3 96 78 NA 6.9 86 8 4 97 35 NA 7.4 85 8 5 98 66 NA 4.6 87 8 6 99 122 255 4.0 89 8 7 100 89 229 10.3 90 8 8 101 110 207 8.0 90 8 9 102 NA 222 8.6 92 8 10 103 NA 137 11.5 86 8 11 104 44 192 11.5 86 8 12 105 28 273 11.5 82 8 13 106 65 157 9.7 80 8 14 107 NA 64 11.5 79 8 15 108 22 71 10.3 77 8 16 109 59 51 6.3 79 8 17 110 23 115 7.4 76 8 18 111 31 244 10.9 78 8 19 112 44 190 10.3 78 8 20 113 21 259 15.5 77 8 21 114 9 36 14.3 72 8 22 115 NA 255 12.6 75 8 23 116 45 212 9.7 79 8 24 117 168 238 3.4 81 8 25 118 73 215 8.0 86 8 26 119 NA 153 5.7 88 8 27 120 76 203 9.7 97 8 28 121 118 225 2.3 94 8 29 122 84 237 6.3 96 8 30 123 85 188 6.3 94 8 31 124 96 167 6.9 91 9 1 125 78 197 5.1 92 9 2 126 73 183 2.8 93 9 3 127 91 189 4.6 93 9 4 128 47 95 7.4 87 9 5 129 32 92 15.5 84 9 6 130 20 252 10.9 80 9 7 131 23 220 10.3 78 9 8 132 21 230 10.9 75 9 9 133 24 259 9.7 73 9 10 134 44 236 14.9 81 9 11 135 21 259 15.5 76 9 12 136 28 238 6.3 77 9 13 137 9 24 10.9 71 9 14 138 13 112 11.5 71 9 15 139 46 237 6.9 78 9 16 140 18 224 13.8 67 9 17 141 13 27 10.3 76 9 18 142 24 238 10.3 68 9 19 143 16 201 8.0 82 9 20 144 13 238 12.6 64 9 21 145 23 14 9.2 71 9 22 146 36 139 10.3 81 9 23 147 7 49 10.3 69 9 24 148 14 20 16.6 63 9 25 149 30 193 6.9 70 9 26 150 NA 145 13.2 77 9 27 151 14 191 14.3 75 9 28 152 18 131 8.0 76 9 29 153 20 223 11.5 68 9 30 > wilcox.test(Ozone ~ Month, data = airquality, subset = Month %in% c(5, 8)) Wilcoxon rank sum test with continuity correction data: Ozone by Month W = 127.5, p-value = 0.0001208 alternative hypothesis: true location shift is not equal to 0 Предупреждение In wilcox.test.default(x = c(41L, 36L, 12L, 18L, 28L, 23L, 19L, : не могу подсчитать точное p-значение при наличии повторяющихся наблюдений > wilcox.test(Solar.R ~ Month, data = airquality, subset = Month %in% c(5, 8)) Wilcoxon rank sum test with continuity correction data: Solar.R by Month W = 422.5, p-value = 0.4588 alternative hypothesis: true location shift is not equal to 0 Предупреждение In wilcox.test.default(x = c(190L, 118L, 149L, 313L, 299L, 99L, : не могу подсчитать точное p-значение при наличии повторяющихся наблюдений > wilcox.test(Temp ~ Month, data = airquality, subset = Month %in% c(5, 8)) Wilcoxon rank sum test with continuity correction data: Temp by Month W = 27, p-value = 1.747e-10 alternative hypothesis: true location shift is not equal to 0 Предупреждение In wilcox.test.default(x = c(67L, 72L, 74L, 62L, 56L, 66L, 65L, : не могу подсчитать точное p-значение при наличии повторяющихся наблюдений > wilcox.test(Wind ~ Month, data = airquality, subset = Month %in% c(5, 8)) Wilcoxon rank sum test with continuity correction data: Wind by Month W = 687.5, p-value = 0.003574 alternative hypothesis: true location shift is not equal to 0 Предупреждение In wilcox.test.default(x = c(7.4, 8, 12.6, 11.5, 14.3, 14.9, 8.6, : не могу подсчитать точное p-значение при наличии повторяющихся наблюдений > boxplot(Temp ~ Month, data = airquality, subset = Month %in% c(5, 8)) > plot(Ozone ~ Temp, data = airquality) > ansari.test(runif(50), runif(50, max = 2)) Ansari-Bradley test data: runif(50) and runif(50, max = 2) AB = 1514, p-value = 0.0009816 alternative hypothesis: true ratio of scales is not equal to 1 > ansari.test(runif(50), runif(50, max = 2), scale = 2) Ansari-Bradley test data: runif(50) and runif(50, max = 2) AB = 1412, p-value = 0.05887 alternative hypothesis: true ratio of scales is not equal to 1 > ansari.test(runif(500), runif(500, max = 2), scale = 2) Ansari-Bradley test data: runif(500) and runif(500, max = 2) AB = 145957, p-value < 2.2e-16 alternative hypothesis: true ratio of scales is not equal to 1 > ansari.test(runif(500), runif(500, max = 2), scale = 0.5) Ansari-Bradley test data: runif(500) and runif(500, max = 2) AB = 147206, p-value < 2.2e-16 alternative hypothesis: true ratio of scales is not equal to 1 > mood.test(runif(500), runif(500, max = 2), scale = 0.5) Mood two-sample test of scale data: runif(500) and runif(500, max = 2) Z = -9.8683, p-value < 2.2e-16 alternative hypothesis: two.sided > mood.test(runif(500), runif(500, max = 2), scale = 2) Mood two-sample test of scale data: runif(500) and runif(500, max = 2) Z = -8.8137, p-value < 2.2e-16 alternative hypothesis: two.sided > ?mood.test > ?ansari.test > mood.test(runif(500), runif(500, max = 1)) Mood two-sample test of scale data: runif(500) and runif(500, max = 1) Z = -0.5788, p-value = 0.5627 alternative hypothesis: two.sided > mood.test(runif(500), runif(500, max = 2, min = 1)) Mood two-sample test of scale data: runif(500) and runif(500, max = 2, min = 1) Z = 0, p-value = 1 alternative hypothesis: two.sided > mood.test(runif(500), runif(500, max = 2, min = 1)) Mood two-sample test of scale data: runif(500) and runif(500, max = 2, min = 1) Z = 0, p-value = 1 alternative hypothesis: two.sided > mood.test(runif(500), runif(500, max = 2, min = 1)) Mood two-sample test of scale data: runif(500) and runif(500, max = 2, min = 1) Z = 0, p-value = 1 alternative hypothesis: two.sided > mood.test(runif(500), runif(500, max = 2, min = 1)) Mood two-sample test of scale data: runif(500) and runif(500, max = 2, min = 1) Z = 0, p-value = 1 alternative hypothesis: two.sided > mood.test function (x, ...) UseMethod("mood.test") > library(nortest) > lillie.test(trees$Height) Lilliefors (Kolmogorov-Smirnov) normality test data: trees$Height D = 0.122, p-value = 0.2826 > lillie.test(rexp(50)) Lilliefors (Kolmogorov-Smirnov) normality test data: rexp(50) D = 0.1674, p-value = 0.001257 > cvm.test(trees$Height) Cramer-von Mises normality test data: trees$Height W = 0.0554, p-value = 0.4229 > ad.test(trees$Height) Anderson-Darling normality test data: trees$Height A = 0.3593, p-value = 0.4282 >