FTtest: Freeman–Tukey Test for Bivariate Distributions via...

View source: R/FTTest.R

FTtestR Documentation

Freeman–Tukey Test for Bivariate Distributions via Conditional Specification

Description

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.

Usage

FTtest(data, distribution, params, num_params)

Arguments

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

Details

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.

Value

A list with components:

observed

Observed frequency table

expected

Expected frequency table under the specified distribution

test

Result of the Freeman–Tukey test, a list with test statistic and p-value

Examples


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




BCD documentation built on June 25, 2025, 5:09 p.m.