Description Usage Arguments Details Value Author(s) See Also Examples

Many one sample goodness of fit tests for categorical data.

1 | ```
cat.goftests(x, props, type = "gsquare", logged = FALSE)
``` |

`x` |
A matrix with the data, where the rows denote the samples and the columns are the variables. The data must be integers and be of the form 1, 2, 3, and so on. The minimum must be 1, and not zero. |

`props` |
The assumed distribution of the data. A vector or percentages summing to 1. |

`type` |
Either Pearson's |

`logged` |
Should the p-values be returned (FALSE) or their logarithm (TRUE)? |

Given a matrix of integers, where each column refers to a sample, the values of a categorical variable the function tests wether these values can be assumed to fit a specific distribution.

A matrix with the test statistic and the p-value of each test.

Michail Tsagris

R implementation and documentation: Michail Tsagris <mtsagris@uoc.gr> and Manos Papadakis <papadakm95@gmail.com>.

1 2 3 4 5 6 7 8 9 | ```
x <- matrix( rbinom(300 * 100, 4, 0.6), ncol = 100 ) + 1
props <- dbinom(0:4, 4, 0.6)
## can we assume that each column comes from a distribution whose mass is given by props?
system.time( cat.goftests(x, props) )
a1 <- cat.goftests(x, props) ## G-square test
a2 <- cat.goftests(x, props, type = "chisq") ## Chi-square test
cor(a1, a2)
mean( abs(a1 - a2) )
x <- NULL
``` |

```
Loading required package: Rcpp
Loading required package: RcppZiggurat
user system elapsed
0.001 0.000 0.001
stat pvalue
stat 1.000000 -0.919092
pvalue -0.919092 1.000000
[1] 0
```

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.