Learn R Programming

tigerstats (version 0.1.6)

chisq.testGC: Chi-Square Test (GC version)

Description

Perform chi-square test, either goodness of fit or test for association. Enter either formula-data input or a summary table. Simulation is optional.

Usage

chisq.testGC(x,data=NULL,p=NULL,graph=FALSE,simulate.p.value=FALSE,B=2000,verbose=TRUE)

Arguments

x
Could be a formula. If so, either ~var (for goodness of fit) or ~var1+var2 (for test for association). Otherwise either a table, matrix or vector of summary data.
data
dataframe supplying variables for formula x.
p
For goodness of fit, a vector of probabilities. This will be automatically scaled so as to sum to 1. Negative elements result in an error message.
graph
produce relevant graph for P-value (chi-square curve or histogram of simulation results). Ignored if user requests R's resampling routines (see below).
simulate.p.value
If FALSE, use a chi-square distribution to estimate the P-value. Other possible values are "random" and "fixed" and TRUE. Random effects are suitable for resampling when the data are a random sample from a poulation. Fixed effects assume that the value
B
number of resamples to take.
verbose
If TRUE, include lots of information in the output.

Value

  • No value, just side effects. Future versions may define an S3 object, with print method.

Examples

Run this code
chisq.testGC(~seat,data=m111survey,p=c(1/3,1/3,1/3))
chisq.testGC(~sex+seat,data=m111survey)

WeBe <- xtabs(~weather+crowd.behavior,data=ledgejump)
chisq.testGC(WeBe,simulate.p.value="fixed",B=2500)

Run the code above in your browser using DataLab