Learn R Programming

broman (version 0.59-5)

chisq: Chi-square test by simuation for a two-way table

Description

Calculate a p-value for a chi-square test by Monte Carlo simulation.

Usage

chisq(tab, n.sim = 1000)

Arguments

tab
A matrix of counts.
n.sim
Number of samples of permuted tables to consider.

Value

  • A single number: the P-value testing independence of rows and columns in the table.

Details

This is like the function chisq.test, but calculates an approximate P-value rather than refering to asymptotics. This will be better for large, sparse tables.

See Also

chisq.test, fisher.test, fisher

Examples

Run this code
TeaTasting <- matrix(c(3,1,1,3),nrow=2)
chisq(TeaTasting,1000)

Run the code above in your browser using DataLab