chisqSh: Chi-Square Simulation (Contingency Table)

Description Usage Arguments Value Note Author(s) Examples

View source: R/chisqSh.R

Description

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

Usage

1

Arguments

x

Could be a formula. If so, it should be of the form ~var (for goodness of fit testing), or~var1+var2 (for association testing). Otherwise it is either a table or matrix of summary data.

data

data frame supplying variables for formula x. If variables in x are not found in the data, then they will be searched for in the parent environment.

p

Null probabilities in a goodness of fit test

options

passed to shiny::runApp.

Value

side effects

Note

This is a locally-run Shiny app. It may not work properly on some R Studio Server set-ups, especially on the CentOS operating system. For best views, open the app in the browser.

Author(s)

Homer White [email protected]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
# test for association, from a data frame:
chisqSh(~am+cyl,data=mtcars)

# test for association, from a summary table:
DoesNotSmoke <- c(NeitherSmokes=1168,OneSmokes=1823,BothSmoke=1380)
Smokes <- c(188,416,400)
ChildParents <- rbind(DoesNotSmoke,Smokes)
chisqSh(ChildParents)

# test for goodness of fit, from a data frame:
chisqSh(~cyl,data=mtcars,p=rep(1/3,3))

#test for goodness of fit, from a summary table:
obs <- c(one=8,two=18,three=11,four=7,five=9,six=7)
chisqSh(obs,p=rep(1/6,6))

## End(Not run)

homerhanumat/ShinyLocalEdu documentation built on May 15, 2017, 11:58 p.m.