Description Usage Arguments Value Examples

View source: R/SimpleChitest.R

Make a faster version of chisq.test() that only computes the chi-square test statistic when the input is two numeric vectors with no missing values. You can try simplifying chisq.test() or by coding from the mathematical de finition. Here we also have the function SimpleTable

This method simplifies the traditional Chi-square test. An example is given to compare the computational speed of this method with that of the traditional method.

1 | ```
SimpleChitest(x, y)
``` |

`x` |
numeric vector with no missing values |

`y` |
numeric vector with no missing values |

STATISTIC the chi-square test statistic

p.value the P-value of chi-square test statistic

1 2 3 4 5 6 | ```
x1<-sample(1:10,1000,replace=TRUE)
x2<-sample(10:20,1000,replace=TRUE)
SimpleChitest(x1,x2)
library(microbenchmark)
ts <- microbenchmark(chisq=chisq.test(x1,x2),simple_chitest=SimpleChitest(x1,x2))
summary(ts)[,c(1,3,5,6)]
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.