Читать книгу The Big R-Book - Philippe J. S. De Brouwer - Страница 285
Chi-Square test in R Function use for chisq.test()
Оглавлениеchisq.test(data)
where data
is the data in form of a table containing the count value of the variables
For example, we can use the mtcars
dataset that is most probably loaded when R was initialised.
# we use the dataset mtcars from MASS df <- data.frame(mtcars$cyl,mtcars$am) chisq.test(df) ## Warning in chisq.test(df): Chi-squared approximation may be incorrect ## ## Pearson’s Chi-squared test ## ## data: df ## X-squared = 25.077, df = 31, p-value = 0.7643
chisq.test()
The chi-square test reports a p-value. This p-value is the probability that the correlations is actually insignificant. It appears that in practice a correlation lower than 5% can be considered as insignificant. In this example, the p-value is higher than 0.05, so there is no significant correlation.