# gofmalm: Goodness-of-Fit Tests for Type-II Censored Samples via Malmquist Transformation

`gofmalm` provides goodness-of-fit (GOF) tests for arbitrary user-specified continuous parametric distributions under Type-II right- or left-censoring.

## Features

- Implements the transformation-based goodness-of-fit testing method of **Lin, Huang, and Balakrishnan (2008)** using the **Malmquist (1950)** transformation.
- Implements the earlier transformation of **Michael and Schucany (1979)**.
- Computes all 9 empirical distribution function (EDF) test statistics ($D_{r,n}, G_{r,n}, T_{r,n}, ^*W^2_{r,n}, W^2_{r,n}, A^2_{r,n}, U^2_{r,n}, ^TA^2_r, ^{*T}A^2_r$).
- Computes direct untransformed censored EDF statistics of **Barr & Davidson (1973)** and **Pettitt & Stephens (1976)** ($_{2}W^2_{r,n}, _{2}A^2_{r,n}$).
- Supports simple hypotheses (known parameters, distribution-free simulation) and composite hypotheses (unknown parameters estimated via MLE, parametric bootstrap).
- Full support for Type-II left-censoring via quantile reflection.

## Installation

You can install `gofmalm` from the source package tarball:

```r
install.packages("gofmalm_0.1.0.tar.gz", repos = NULL, type = "source")
```

## Quick Example

```r
library(gofmalm)

# Example 1: Testing Uniform(0,1) with r = 5, n = 10 (simple hypothesis)
data_unif <- c(0.03, 0.06, 0.10, 0.11, 0.13)
res1 <- gof_censored(
  data = data_unif,
  n = 10,
  pdf = dunif,
  cdf = punif,
  sf = function(x, p) 1 - punif(x),
  estimate = FALSE,
  pvalue_method = "distribution_free",
  nsim = 1000,
  seed = 123
)
print(res1)
```

## References

- Lin, C.-T., Huang, Y.-L., & Balakrishnan, N. (2008). A New Method for Goodness-of-Fit Testing Based on Type-II Right Censored Samples. *IEEE Transactions on Reliability*, 57(4), 633–642. <doi:10.1109/TR.2008.2005860>
- Michael, J. R., & Schucany, W. R. (1979). A New Approach to Testing Goodness of Fit for Censored Samples. *Technometrics*, 21(4), 435–441. <doi:10.1080/00401706.1979.10489813>
- Pettitt, A. N., & Stephens, M. A. (1976). Modified Cramér-von Mises statistics for censored data. *Biometrika*, 63(2), 291–298. <doi:10.1093/biomet/63.2.291>
