Title: | Chi-Squared Test for Goodness of Fit and Independence Test |
---|---|
Description: | The chi-squared test for goodness of fit and independence test. |
Authors: | Atchanut Rattanalertnusorn [cre, aut], Jiranan Choojai [aut], Chutima Philadee [aut], Kittipong Klinjan [aut], Issaraporn Thiamsorn [aut] |
Maintainer: | Atchanut Rattanalertnusorn <[email protected]> |
License: | GPL-3 |
Version: | 0.1.3 |
Built: | 2025-02-16 04:45:57 UTC |
Source: | https://github.com/cran/Mychisq |
This function is the goodness of fit test
gofchisq(x, p, conf.level = 0.95)
gofchisq(x, p, conf.level = 0.95)
x |
a vector of observed |
p |
probability of each group |
conf.level |
confidence level |
output for goodness of fit test
Chernoff, H.; Lehmann, E. L.(1954) <doi:10.1214/aoms/1177728726>.
x=c(12,9,10,7,12) prob=c(1/5,1/5,1/5,1/5,1/5) #1:1:1:1:1 gofchisq(x=x,p=prob)
x=c(12,9,10,7,12) prob=c(1/5,1/5,1/5,1/5,1/5) #1:1:1:1:1 gofchisq(x=x,p=prob)
This function is for independence test
indchisq(O, conf.level = 0.95)
indchisq(O, conf.level = 0.95)
O |
an observed matrix has a rows and b columns |
conf.level |
confidence level |
output for independence test
Plackett, R. L. (1983). <doi:10.2307/1402731>.
v <- c(80,60,150,50,40,20) X<- matrix(v,ncol=2,byrow = TRUE) # 3x2 indchisq(X)
v <- c(80,60,150,50,40,20) X<- matrix(v,ncol=2,byrow = TRUE) # 3x2 indchisq(X)
The plot of Chi-squared distribution with k degrees of freedom
plotchisq(df = 8)
plotchisq(df = 8)
df |
degrees of freedom |
The figure of Chi-squared distribution with k degrees of freedom
plotchisq(df=10)
plotchisq(df=10)