FTtest | R Documentation |
Performs a goodness-of-fit test using the Freeman–Tukey (F–T) statistic for a given dataset and a specified bivariate distribution via Conditional Specification.
FTtest(data, distribution, params, num_params)
data |
a dataset or matrix with two columns. |
distribution |
a string specifying the theoretical distribution ('"BBCD"', '"BBPD"', or '"BBGD"'). |
params |
a named list of parameters required by the specified distribution. |
num_params |
an integer specifying the number of parameters that were estimated |
The Freeman–Tukey (F–T) statistic is used to assess the goodness of fit in contingency tables. It is defined as:
T^2 = 4 \sum_{i=1}^{r} \sum_{j=1}^{c} \left( \sqrt{O_{ij}} - \sqrt{E_{ij}} \right)^2
where O_{ij}
and E_{ij}
are the observed and expected frequencies, respectively.
The statistic T^2
asymptotically follows a chi-squared distribution with
(r \cdot c - 1)
degrees of freedom, where r
is the number of rows
and c
is the number of columns in the contingency table.
A list with components:
Observed frequency table
Expected frequency table under the specified distribution
Result of the Freeman–Tukey test, a list with test statistic and p-value
samples <- rgeomBCD(n = 20, q1 = 0.5, q2 = 0.5, q3 = 0.1, seed = 123)
params <- MLEgeomBCD(samples)
result_bgcd <- FTtest(samples, "BGCD", params, num_params = 3)
result_bgcd
samples <- rpoisBCD(20, lambda1=.5, lambda2=.5, lambda3=.5)
params <- MLEpoisBCD(samples)
result_bpcd <- FTtest(samples, "BPCD", params, num_params = 3)
result_bpcd
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.