R version 4.2.3 (2023-03-15 ucrt) -- "Shortstop Beagle" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- rnorm(50) > hist(x) > hist(x,probability=TRUE) > z <- seq(-2.5,2,0.1) > lines(z,dnorm(z)) > z <- seq(-2.5,2.5,0.1) > hist(x,probability=TRUE) > lines(z,dnorm(z)) > y <- rexp(50) > y <- rexp(50) > hist(y,probability=TRUE) > z2 <- seq(0,6,0.1) > lines(z2,dexp(z2)) > plot(z2,pexp(z2)) > lines(z2,dnorm(z2),col="blue") > > plot(z2,pexp(z2),type="l") > lines(z2,dnorm(z2),col="blue") > plot(z2,pexp(z2),type="l") > lines(z2,dexp(z2),col="blue") > ecdf(y) Empirical CDF Call: ecdf(y) x[1:50] = 0.0075671, 0.015554, 0.031056, ..., 4.2276, 4.6481 > plot(ecdf(y)) > plot(ecdf(y)) > lines(z2,pexp(z2)) > lines(z2,pexp(z2),col="red") > lines(z2,pnorm(z2),col="blue") > y [1] 0.346034943 1.779239919 4.227611918 3.302554525 [5] 0.207280015 2.018080305 0.578814990 0.325902898 [9] 2.537300506 1.315225562 4.648104567 0.564963880 [13] 0.816894169 0.091858808 0.204225358 0.893134940 [17] 1.322951653 0.829964187 0.247628415 1.364483530 [21] 1.852019463 0.627426800 0.160129313 0.937490303 [25] 2.187155394 0.751633704 0.690064073 0.470675648 [29] 0.015554075 0.054078710 0.031055512 0.604153465 [33] 0.934771142 3.867945483 0.508153846 1.507729555 [37] 0.135825323 0.007567149 0.418202637 0.534001115 [41] 0.174532329 0.495698506 0.810017443 1.292930607 [45] 0.872821781 0.901687504 0.057179762 0.971431497 [49] 0.099467597 0.090112556 > a <- rexp(11) > a [1] 0.9704565 0.3979141 1.0000992 0.5537543 [5] 1.3960821 0.7832498 1.9193638 0.6669857 [9] 0.6858088 2.4391120 0.3358928 > a <- sort(a) > quantile(a,0.5) 50% 0.7832498 > a[6] [1] 0.7832498 > quantile(a,0.3) 30% 0.6669857 > a[4] [1] 0.6669857 > quantile(a,0) 0% 0.3358928 > quantile(a,1) 100% 2.439112 > quantile(a,0.25) 25% 0.61037 > a[3] [1] 0.5537543 > a[4] [1] 0.6669857 > quantile(a,seq(0,1,0.1)) 0% 10% 20% 30% 40% 0.3358928 0.3979141 0.5537543 0.6669857 0.6858088 50% 60% 70% 80% 90% 0.7832498 0.9704565 1.0000992 1.3960821 1.9193638 100% 2.4391120 > a [1] 0.3358928 0.3979141 0.5537543 0.6669857 [5] 0.6858088 0.7832498 0.9704565 1.0000992 [9] 1.3960821 1.9193638 2.4391120 > qexp(seq(0,1,0.1)) [1] 0.0000000 0.1053605 0.2231436 0.3566749 [5] 0.5108256 0.6931472 0.9162907 1.2039728 [9] 1.6094379 2.3025851 Inf > qexp(seq(0,1,0.1)) - a [1] -0.33589284 -0.29255359 -0.33061078 -0.31031079 [5] -0.17498318 -0.09010267 -0.05416573 0.20387364 [9] 0.21335582 0.38322133 Inf > qexp(seq(0,1,0.1)) - quantile(y,seq(0,1,0.1)) 0% 10% 20% 30% -0.007567149 0.018541239 0.051491825 0.016679615 40% 50% 60% 70% -0.012836584 0.034401744 0.069183508 0.256300143 80% 90% 100% 0.216305178 0.080415188 Inf > qexp(0.3) [1] 0.3566749 > plot(qexp(seq(0,1,0.1)),quantile(y,seq(0,1,0.1))) > plot(qexp(seq(0,1,0.1)), + quantile(y,seq(0,1,0.1)), + ylim=c(0,1)) > plot(qexp(seq(0,1,0.1)), + quantile(y,seq(0,1,0.1)), + ylim=c(0,1),xlim=c(0,1)) > ?abline starting httpd help server ... done > abline(0,1) > plot(qexp(seq(0,1,0.05)), + quantile(y,seq(0,1,0.05)), + ylim=c(0,1),xlim=c(0,1)) > abline(0,1) > ?qqplot > ?ppoints > ppoints(11) [1] 0.04545455 0.13636364 0.22727273 0.31818182 [5] 0.40909091 0.50000000 0.59090909 0.68181818 [9] 0.77272727 0.86363636 0.95454545 > ppoints(10) [1] 0.06097561 0.15853659 0.25609756 0.35365854 [5] 0.45121951 0.54878049 0.64634146 0.74390244 [9] 0.84146341 0.93902439 > ppoints(9) [1] 0.06756757 0.17567568 0.28378378 0.39189189 [5] 0.50000000 0.60810811 0.71621622 0.82432432 [9] 0.93243243 > ppoints(5) [1] 0.1190476 0.3095238 0.5000000 0.6904762 [5] 0.8809524 > ppoints(4) [1] 0.1470588 0.3823529 0.6176471 0.8529412 > ppoints(3) [1] 0.1923077 0.5000000 0.8076923 > qqplot(y,qexp(seq(0,1,0.1))) > abline(0,1) > qqnorm(y) > abline(0,1) > qqnorm(x) > abline(0,1) > b <- 2*x + 2 > qqnorm(b) > abline(0,1) > abline(2,2,col="blue") > qqline(b,col="red") > x <- round(runif(30)) > y <- round(runif(30)) > z <- x + y > x [1] 1 1 1 1 1 1 0 1 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 [25] 0 0 1 0 0 0 > y [1] 0 1 1 0 0 0 1 0 0 0 0 1 1 0 1 1 1 1 1 1 1 1 0 1 [25] 0 0 0 0 1 0 > z [1] 1 2 2 1 1 1 1 1 0 0 0 1 1 0 2 1 1 2 2 1 2 1 0 2 [25] 0 0 1 0 1 0 > table(x) x 0 1 17 13 > table(x,y) y x 0 1 0 9 8 1 6 7 > df <- data.frame(x=x,y=y,z=z) > df x y z 1 1 0 1 2 1 1 2 3 1 1 2 4 1 0 1 5 1 0 1 6 1 0 1 7 0 1 1 8 1 0 1 9 0 0 0 10 0 0 0 11 0 0 0 12 0 1 1 13 0 1 1 14 0 0 0 15 1 1 2 16 0 1 1 17 0 1 1 18 1 1 2 19 1 1 2 20 0 1 1 21 1 1 2 22 0 1 1 23 0 0 0 24 1 1 2 25 0 0 0 26 0 0 0 27 1 0 1 28 0 0 0 29 0 1 1 30 0 0 0 > table(x,y) y x 0 1 0 9 8 1 6 7 > table(x,z) z x 0 1 2 0 9 8 0 1 0 6 7 > chisq.test(x,z) Pearson's Chi-squared test data: x and z X-squared = 16.037, df = 2, p-value = 0.0003292 Warning message: In chisq.test(x, z) : Chi-squared approximation may be incorrect > t <- seq(0,20,0.5) > plot(t,dchisq(t,df=2),type="l") > chisq.test(x,z) -> teszt Warning message: In chisq.test(x, z) : Chi-squared approximation may be incorrect > teszt$stat X-squared 16.03749 > teszt$statistic X-squared 16.03749 > abline(v = teszt$stat) > teszt$stat -> chisq > chisq X-squared 16.03749 > pchisq(chisq) Error in pchisq(chisq) : argument "df" is missing, with no default > pchisq(chisq,df=2) X-squared 0.9996708 > 1-pchisq(chisq,df=2) X-squared 0.0003292326 > teszt$par df 2 > teszt$parameter df 2 > teszt$p.value [1] 0.0003292326 > qchisq(0.9,df=2) [1] 4.60517 > abline(v = qchisq(0.9,df=2),col="red") > chisq.test(x,y) Pearson's Chi-squared test with Yates' continuity correction data: x and y X-squared = 0, df = 1, p-value = 1 > x [1] 1 1 1 1 1 1 0 1 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0 0 1 [28] 0 0 0 > y [1] 0 1 1 0 0 0 1 0 0 0 0 1 1 0 1 1 1 1 1 1 1 1 0 1 0 0 0 [28] 0 1 0 > x <- rnorm(30) > y <- rnorm(30) + 1 > # t-teszt: tegyuk fel, hogy Gauss valtazoink vannak > # varhato ertek =? 0 > # H0: varhato ertek = 0 > $ H1: varhato ertek =/= 0 Error: unexpected '$' in "$" > t.test(x) One Sample t-test data: x t = -1.2084, df = 29, p-value = 0.2367 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.4827579 0.1241691 sample estimates: mean of x -0.1792944 > x [1] 0.36599732 0.77754927 -1.17460354 -0.18660949 [5] -0.36382404 0.22797985 0.30723704 -1.04138133 [9] 0.39799068 -1.15321526 -0.39964973 -0.22124303 [13] -1.03517926 -0.08892231 -1.21923719 -0.53979500 [17] -0.67752702 -0.91419431 -1.60887726 0.82031848 [21] 0.05325837 -0.56113919 -0.76359421 1.19210369 [25] 0.71293663 0.03469067 2.11383701 -0.06395543 [29] -0.42868988 0.05890665 > y [1] 2.50467378 1.24846030 0.44549377 1.41263286 [5] 0.83586701 1.65332882 0.64833336 1.75580450 [9] -0.60837380 1.75898779 0.01286649 0.98887694 [13] 0.87170144 0.24049632 1.89901885 1.45670647 [17] -1.51348560 2.02528024 1.20893757 2.54278937 [21] 1.29512479 1.58135308 0.63771454 -0.50246458 [25] 2.02850849 -0.32386856 0.45529242 1.09337580 [29] 2.93888744 0.21382659 > hist(x) > t.test(x) One Sample t-test data: x t = -1.2084, df = 29, p-value = 0.2367 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.4827579 0.1241691 sample estimates: mean of x -0.1792944 > teszt <- t.test(x) > teszt$stat t -1.208377 > var(x) [1] 0.6604652 > mean(x) [1] -0.1792944 > y [1] 2.50467378 1.24846030 0.44549377 1.41263286 [5] 0.83586701 1.65332882 0.64833336 1.75580450 [9] -0.60837380 1.75898779 0.01286649 0.98887694 [13] 0.87170144 0.24049632 1.89901885 1.45670647 [17] -1.51348560 2.02528024 1.20893757 2.54278937 [21] 1.29512479 1.58135308 0.63771454 -0.50246458 [25] 2.02850849 -0.32386856 0.45529242 1.09337580 [29] 2.93888744 0.21382659 > mean(y) [1] 1.026872 > t.test(y) One Sample t-test data: y t = 5.5505, df = 29, p-value = 5.501e-06 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: 0.6484912 1.4052519 sample estimates: mean of x 1.026872 > z <- rnorm(10) + 0.1 > t.test(z) One Sample t-test data: z t = 1.4505, df = 9, p-value = 0.1809 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.2542384 1.1629602 sample estimates: mean of x 0.4543609 > z <- rnorm(10) + 0.1 ; t.test(z) One Sample t-test data: z t = 1.353, df = 9, p-value = 0.2091 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.1796417 0.7143028 sample estimates: mean of x 0.2673305 > z <- rnorm(10) + 0.1 ; t.test(z) One Sample t-test data: z t = 0.63285, df = 9, p-value = 0.5426 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.5116183 0.9090574 sample estimates: mean of x 0.1987195 > z <- rnorm(10) + 0.1 ; t.test(z) One Sample t-test data: z t = 1.2571, df = 9, p-value = 0.2404 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.3633614 1.2722468 sample estimates: mean of x 0.4544427 > z <- rnorm(10) + 0.1 ; t.test(z) One Sample t-test data: z t = -1.2076, df = 9, p-value = 0.258 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.9732422 0.2958049 sample estimates: mean of x -0.3387186 > z <- rnorm(10) + 0.1 ; t.test(z) One Sample t-test data: z t = -1.6922, df = 9, p-value = 0.1249 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -1.4941164 0.2153533 sample estimates: mean of x -0.6393816 > z <- rnorm(10) + 0.1 ; t.test(z) One Sample t-test data: z t = -0.47273, df = 9, p-value = 0.6477 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.7814750 0.5113144 sample estimates: mean of x -0.1350803 > z <- rnorm(10) + 0.1 ; t.test(z) One Sample t-test data: z t = 0.44523, df = 9, p-value = 0.6667 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.6882192 1.0255107 sample estimates: mean of x 0.1686457 > z <- rnorm(10) + 0.1 ; t.test(z) One Sample t-test data: z t = 0.52179, df = 9, p-value = 0.6144 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.5038254 0.8059329 sample estimates: mean of x 0.1510537 > z <- rnorm(10) + 0.1 ; t.test(z) One Sample t-test data: z t = 0.91726, df = 9, p-value = 0.3829 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.4457888 1.0538708 sample estimates: mean of x 0.304041 > z <- rnorm(10) + 0.1 ; t.test(z) One Sample t-test data: z t = -0.12318, df = 9, p-value = 0.9047 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.7290440 0.6537489 sample estimates: mean of x -0.03764751 > z <- rnorm(10) + 0.1 ; t.test(z) One Sample t-test data: z t = 0.10058, df = 9, p-value = 0.9221 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.6654650 0.7273959 sample estimates: mean of x 0.03096547 > z <- rnorm(10) + 0.1 ; t.test(z) One Sample t-test data: z t = 0.5896, df = 9, p-value = 0.57 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.5637012 0.9611260 sample estimates: mean of x 0.1987124 > z <- rnorm(10) + 0.1 ; t.test(z) One Sample t-test data: z t = -0.14721, df = 9, p-value = 0.8862 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.6128267 0.5379405 sample estimates: mean of x -0.03744309 > z <- rnorm(10) + 0.1 ; t.test(z) One Sample t-test data: z t = 0.48951, df = 9, p-value = 0.6362 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.5655397 0.8778829 sample estimates: mean of x 0.1561716 > z <- rnorm(10) + 2 ; t.test(z) One Sample t-test data: z t = 6.5575, df = 9, p-value = 0.0001043 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: 1.553042 3.188866 sample estimates: mean of x 2.370954 > z <- rnorm(10) + 2 ; t.test(z) One Sample t-test data: z t = 9.2795, df = 9, p-value = 6.643e-06 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: 1.381191 2.271686 sample estimates: mean of x 1.826438 > z <- rnorm(10) + 2 ; t.test(z) One Sample t-test data: z t = 4.8048, df = 9, p-value = 0.0009672 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: 1.197922 3.329471 sample estimates: mean of x 2.263696 > z <- rnorm(10) + 2 ; t.test(z) One Sample t-test data: z t = 5.736, df = 9, p-value = 0.0002812 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: 1.145882 2.638270 sample estimates: mean of x 1.892076 > z <- rnorm(10); t.test(z) One Sample t-test data: z t = 0.20735, df = 9, p-value = 0.8404 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.9593107 1.1529148 sample estimates: mean of x 0.09680202 > z <- rnorm(10); t.test(z) One Sample t-test data: z t = -0.8245, df = 9, p-value = 0.431 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -1.1262526 0.5245671 sample estimates: mean of x -0.3008427 > z <- rnorm(10); t.test(z) One Sample t-test data: z t = -2.0704, df = 9, p-value = 0.06831 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.89860760 0.03976215 sample estimates: mean of x -0.4294227 > ?t.test > z [1] -0.2442521 -0.5968630 -0.4999378 -1.1152654 -1.0677565 [6] 0.6110595 -0.0907535 0.5466837 -1.3044389 -0.5327030 > x [1] 0.36599732 0.77754927 -1.17460354 -0.18660949 [5] -0.36382404 0.22797985 0.30723704 -1.04138133 [9] 0.39799068 -1.15321526 -0.39964973 -0.22124303 [13] -1.03517926 -0.08892231 -1.21923719 -0.53979500 [17] -0.67752702 -0.91419431 -1.60887726 0.82031848 [21] 0.05325837 -0.56113919 -0.76359421 1.19210369 [25] 0.71293663 0.03469067 2.11383701 -0.06395543 [29] -0.42868988 0.05890665 > t.test(x,z) Welch Two Sample t-test data: x and z t = 0.98084, df = 19.023, p-value = 0.339 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.2835807 0.7838374 sample estimates: mean of x mean of y -0.1792944 -0.4294227 > t.test(x) One Sample t-test data: x t = -1.2084, df = 29, p-value = 0.2367 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.4827579 0.1241691 sample estimates: mean of x -0.1792944 > t <- seq(-3,3,0.1) > plot(t,dnorm(t)) > plot(t,dnorm(t),type="l") > abline(v=qnorm(c(0.025,0.975))) > t.test(x,conf.level=0.9) One Sample t-test data: x t = -1.2084, df = 29, p-value = 0.2367 alternative hypothesis: true mean is not equal to 0 90 percent confidence interval: -0.43140446 0.07281568 sample estimates: mean of x -0.1792944 > x [1] 0.36599732 0.77754927 -1.17460354 -0.18660949 [5] -0.36382404 0.22797985 0.30723704 -1.04138133 [9] 0.39799068 -1.15321526 -0.39964973 -0.22124303 [13] -1.03517926 -0.08892231 -1.21923719 -0.53979500 [17] -0.67752702 -0.91419431 -1.60887726 0.82031848 [21] 0.05325837 -0.56113919 -0.76359421 1.19210369 [25] 0.71293663 0.03469067 2.11383701 -0.06395543 [29] -0.42868988 0.05890665 > y [1] 2.50467378 1.24846030 0.44549377 1.41263286 [5] 0.83586701 1.65332882 0.64833336 1.75580450 [9] -0.60837380 1.75898779 0.01286649 0.98887694 [13] 0.87170144 0.24049632 1.89901885 1.45670647 [17] -1.51348560 2.02528024 1.20893757 2.54278937 [21] 1.29512479 1.58135308 0.63771454 -0.50246458 [25] 2.02850849 -0.32386856 0.45529242 1.09337580 [29] 2.93888744 0.21382659 > z <- x+y > z [1] 2.8706711 2.0260096 -0.7291098 1.2260234 0.4720430 [6] 1.8813087 0.9555704 0.7144232 -0.2103831 0.6057725 [11] -0.3867832 0.7676339 -0.1634778 0.1515740 0.6797817 [16] 0.9169115 -2.1910126 1.1110859 -0.3999397 3.3631078 [21] 1.3483832 1.0202139 -0.1258797 0.6896391 2.7414451 [26] -0.2891779 2.5691294 1.0294204 2.5101976 0.2727332 > y [1] 2.50467378 1.24846030 0.44549377 1.41263286 [5] 0.83586701 1.65332882 0.64833336 1.75580450 [9] -0.60837380 1.75898779 0.01286649 0.98887694 [13] 0.87170144 0.24049632 1.89901885 1.45670647 [17] -1.51348560 2.02528024 1.20893757 2.54278937 [21] 1.29512479 1.58135308 0.63771454 -0.50246458 [25] 2.02850849 -0.32386856 0.45529242 1.09337580 [29] 2.93888744 0.21382659 > v <- x + rnorm(30) > t.test(x,v,paired=TRUE) Paired t-test data: x and v t = 1.8855, df = 29, p-value = 0.06941 alternative hypothesis: true mean difference is not equal to 0 95 percent confidence interval: -0.02680605 0.65978786 sample estimates: mean difference 0.3164909 > t.test(x,alternative="greater") One Sample t-test data: x t = -1.2084, df = 29, p-value = 0.8817 alternative hypothesis: true mean is greater than 0 95 percent confidence interval: -0.4314045 Inf sample estimates: mean of x -0.1792944 > t.test(x,alternative="less") One Sample t-test data: x t = -1.2084, df = 29, p-value = 0.1183 alternative hypothesis: true mean is less than 0 95 percent confidence interval: -Inf 0.07281568 sample estimates: mean of x -0.1792944 > t.test(x) One Sample t-test data: x t = -1.2084, df = 29, p-value = 0.2367 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.4827579 0.1241691 sample estimates: mean of x -0.1792944 > x [1] 0.36599732 0.77754927 -1.17460354 -0.18660949 [5] -0.36382404 0.22797985 0.30723704 -1.04138133 [9] 0.39799068 -1.15321526 -0.39964973 -0.22124303 [13] -1.03517926 -0.08892231 -1.21923719 -0.53979500 [17] -0.67752702 -0.91419431 -1.60887726 0.82031848 [21] 0.05325837 -0.56113919 -0.76359421 1.19210369 [25] 0.71293663 0.03469067 2.11383701 -0.06395543 [29] -0.42868988 0.05890665 > y [1] 2.50467378 1.24846030 0.44549377 1.41263286 [5] 0.83586701 1.65332882 0.64833336 1.75580450 [9] -0.60837380 1.75898779 0.01286649 0.98887694 [13] 0.87170144 0.24049632 1.89901885 1.45670647 [17] -1.51348560 2.02528024 1.20893757 2.54278937 [21] 1.29512479 1.58135308 0.63771454 -0.50246458 [25] 2.02850849 -0.32386856 0.45529242 1.09337580 [29] 2.93888744 0.21382659 > v [1] -1.00494994 1.35676207 -1.79619239 0.03434945 [5] -0.73723705 0.68505637 -2.09348885 -1.77718721 [9] 0.09888799 -0.71724564 -1.19926527 -1.60073374 [13] 1.03716536 -0.45613444 -2.07846129 -2.20906698 [17] -1.19872382 0.13175144 -1.95769599 -0.59719469 [21] -0.32971714 -0.10476676 -0.58964496 1.42185463 [25] 0.03027805 -0.29441528 2.88965149 -0.62558458 [29] 0.07506737 -1.26667716 > xint <- cut(x,breaks=3) > xint [1] (-0.368,0.873] (-0.368,0.873] (-1.61,-0.368] [4] (-0.368,0.873] (-0.368,0.873] (-0.368,0.873] [7] (-0.368,0.873] (-1.61,-0.368] (-0.368,0.873] [10] (-1.61,-0.368] (-1.61,-0.368] (-0.368,0.873] [13] (-1.61,-0.368] (-0.368,0.873] (-1.61,-0.368] [16] (-1.61,-0.368] (-1.61,-0.368] (-1.61,-0.368] [19] (-1.61,-0.368] (-0.368,0.873] (-0.368,0.873] [22] (-1.61,-0.368] (-1.61,-0.368] (0.873,2.12] [25] (-0.368,0.873] (-0.368,0.873] (0.873,2.12] [28] (-0.368,0.873] (-1.61,-0.368] (-0.368,0.873] Levels: (-1.61,-0.368] (-0.368,0.873] (0.873,2.12] > vint <- cut(v,breaks=seq(-3,3,2)) > vint [1] (-3,-1] (1,3] (-3,-1] (-1,1] (-1,1] (-1,1] [7] (-3,-1] (-3,-1] (-1,1] (-1,1] (-3,-1] (-3,-1] [13] (1,3] (-1,1] (-3,-1] (-3,-1] (-3,-1] (-1,1] [19] (-3,-1] (-1,1] (-1,1] (-1,1] (-1,1] (1,3] [25] (-1,1] (-1,1] (1,3] (-1,1] (-1,1] (-3,-1] Levels: (-3,-1] (-1,1] (1,3] > table(xint,vint) vint xint (-3,-1] (-1,1] (1,3] (-1.61,-0.368] 7 5 1 (-0.368,0.873] 4 10 1 (0.873,2.12] 0 0 2 > chisq.test(xint,vint) Pearson's Chi-squared test data: xint and vint X-squared = 16.445, df = 4, p-value = 0.002476 Warning message: In chisq.test(xint, vint) : Chi-squared approximation may be incorrect > yint <- cut(y,breaks=2) > chisq.test(xint,yint) Pearson's Chi-squared test data: xint and yint X-squared = 3.721, df = 2, p-value = 0.1556 Warning message: In chisq.test(xint, yint) : Chi-squared approximation may be incorrect > table(xint,yint) yint xint (-1.52,0.713] (0.713,2.94] (-1.61,-0.368] 4 9 (-0.368,0.873] 5 10 (0.873,2.12] 2 0 >