The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Package {gofmalm}


Type: Package
Title: Goodness-of-Fit Tests for Type-II Censored Samples via the Malmquist Transformation
Version: 0.1.0
Description: Goodness-of-fit tests for an arbitrary user-specified continuous distribution under Type-II right- or left-censoring. Implements the transformation-based method of Lin, Huang and Balakrishnan (2008) <doi:10.1109/TR.2008.2005860>, which uses a property of order statistics due to Malmquist (1950) to convert an r-out-of-n Type-II censored uniform sample into a complete sample of size r, alongside the earlier transformation of Michael and Schucany (1979) <doi:10.1080/00401706.1979.10489813>. Also implements the direct (untransformed) censored-sample statistics of Barr and Davidson (1973) <doi:10.1080/00401706.1973.10489108> and Pettitt and Stephens (1976) <doi:10.1093/biomet/63.2.291>, and the modified-statistic maximum-likelihood procedure of Chen and Balakrishnan (1995) for testing composite hypotheses. General background on empirical-distribution-function goodness-of-fit methods follows D'Agostino and Stephens (1986, ISBN:982-0-8247-7487-5).
License: MIT + file LICENSE
Encoding: UTF-8
Language: en-US
Depends: R (≥ 4.1.0)
Imports: stats, graphics
Suggests: testthat (≥ 3.0.0)
RoxygenNote: 7.3.3
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2026-07-22 11:04:04 UTC; shikhar tyagi
Author: Shikhar Tyagi ORCID iD [aut, cre], Arvind Pandey [aut], Bhupendra Singh [aut], Vrijesh Tripathi [aut]
Maintainer: Shikhar Tyagi <shikhar1093tyagi@gmail.com>
Repository: CRAN
Date/Publication: 2026-07-30 17:40:08 UTC

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

Description

Goodness-of-fit tests for an arbitrary user-specified continuous distribution under Type-II right- or left-censoring. Implements the transformation-based method of Lin, Huang and Balakrishnan (2008) doi:10.1109/TR.2008.2005860, which uses a property of order statistics due to Malmquist (1950) to convert an r-out-of-n Type-II censored uniform sample into a complete sample of size r, alongside the earlier transformation of Michael and Schucany (1979) doi:10.1080/00401706.1979.10489813. Also implements the direct (untransformed) censored-sample statistics of Barr and Davidson (1973) doi:10.1080/00401706.1973.10489108 and Pettitt and Stephens (1976) doi:10.1093/biomet/63.2.291, and the modified-statistic maximum-likelihood procedure of Chen and Balakrishnan (1995) for testing composite hypotheses. General background on empirical-distribution-function goodness-of-fit methods follows D'Agostino and Stephens (1986, ISBN:978-0-8247-7487-5).

Author(s)

Maintainer: Shikhar Tyagi shikhar1093tyagi@gmail.com (ORCID)

Authors:


Maximum Likelihood Estimation for Type-II Censored Samples

Description

Estimates distribution parameters under Type-II right- or left-censoring.

Usage

fit_mle(
  data,
  n,
  pdf,
  cdf,
  sf = NULL,
  params,
  censoring = c("right", "left"),
  optim_control = list()
)

Arguments

data

Numeric vector of length r, sorted ascending.

n

Total sample size (n >= r).

pdf

Probability density function.

cdf

Cumulative distribution function.

sf

Survival function. If NULL, computed as 1 - cdf(x, params).

params

Named list or vector of starting parameter values.

censoring

Type of censoring: "right" or "left".

optim_control

Optional control list passed to optim.

Value

A list containing par (estimated parameters), value (negative log-likelihood), convergence status code, and message.

Examples

data_exp <- c(0.1, 0.2, 0.3, 0.4, 0.7, 1.0, 1.4)
fit <- fit_mle(
  data = data_exp, n = 20,
  pdf = function(x, p) dexp(x, rate = p$rate),
  cdf = function(x, p) pexp(x, rate = p$rate),
  params = list(rate = 0.1),
  censoring = "right"
)
fit$par

Goodness-of-Fit Testing for Type-II Censored Samples

Description

Performs goodness-of-fit tests for arbitrary user-specified continuous parametric distributions under Type-II right- or left-censoring using the Malmquist and Michael-Schucany transformations.

Usage

gof_censored(
  data,
  n,
  pdf,
  cdf,
  sf = NULL,
  params = NULL,
  estimate = TRUE,
  censoring = c("right", "left"),
  transform = c("both", "malmquist", "ms"),
  statistics = c("all", "direct7", "complete_ad", "composite_mle", "direct_censored"),
  pvalue_method = c("auto", "distribution_free", "parametric_bootstrap"),
  nsim = 2000,
  seed = NULL,
  optim_control = list()
)

Arguments

data

Numeric vector of observed order statistics, length r.

n

Total sample size (n >= length(data)).

pdf

Probability density function f(x, params).

cdf

Cumulative distribution function F(x, params).

sf

Survival function S(x, params). If NULL, computed as 1 - cdf(x, params).

params

Named list/vector of fixed parameter values (if estimate = FALSE) or starting values for MLE (if estimate = TRUE).

estimate

Logical; TRUE for composite hypothesis (unknown parameters estimated via MLE), FALSE for simple hypothesis.

censoring

Type of censoring: "right" or "left".

transform

Transformations to compute: "both", "malmquist", or "ms".

statistics

Subset of statistics to compute: "all", "direct7", "complete_ad", "composite_mle", or "direct_censored".

pvalue_method

Method for p-values: "auto", "distribution_free", or "parametric_bootstrap".

nsim

Number of Monte Carlo or bootstrap simulation replicates.

seed

Optional random seed.

optim_control

Optional control list passed to optim.

Value

An S3 object of class "gofmalm".

Examples

# Simple hypothesis test on Uniform(0,1) with r=5, n=10
data_unif <- c(0.03, 0.06, 0.10, 0.11, 0.13)
res <- gof_censored(
  data = data_unif, n = 10,
  pdf = dunif, cdf = punif,
  estimate = FALSE, pvalue_method = "distribution_free",
  nsim = 500, seed = 123
)
print(res)

Compute Distribution-Free p-values for Simple Hypotheses

Description

Obtains p-values for EDF goodness-of-fit statistics via Monte Carlo simulation from Uniform(0,1) order statistics.

Usage

pvalue_distribution_free(
  u_obs,
  n,
  r,
  censoring = c("right", "left"),
  nsim = 2000,
  seed = NULL
)

Arguments

u_obs

Observed order statistics u_1:n < ... < u_r:n.

n

Total sample size.

r

Number of observed failures.

censoring

Type of censoring: "right" or "left".

nsim

Number of Monte Carlo simulation replicates (default 2000).

seed

Optional random seed.

Value

Named numeric vector of empirical p-values for each statistic.


Compute Parametric Bootstrap p-values for Composite Hypotheses

Description

Obtains p-values for composite hypothesis tests where parameters are estimated from data.

Usage

pvalue_parametric_bootstrap(
  data,
  n,
  pdf,
  cdf,
  sf = NULL,
  params_hat,
  censoring = c("right", "left"),
  transform = c("both", "malmquist", "ms"),
  nsim = 2000,
  seed = NULL,
  optim_control = list()
)

Arguments

data

Observed data vector of length r.

n

Total sample size.

pdf

Density function.

cdf

Distribution function.

sf

Survival function.

params_hat

Estimated parameter list from observed data.

censoring

Type of censoring.

transform

Transformation method ("ms", "malmquist", or "both").

nsim

Number of bootstrap replicates (default 2000).

seed

Optional random seed.

optim_control

Optional control list passed to optim.

Value

A list containing empirical p-values and number of valid replicates.


Composite Hypothesis Procedure for Type-II Censored Samples

Description

Evaluates goodness-of-fit under unknown parameters using MLE estimation, transformation to complete sample, normal residual standardization, and modified CvM/AD statistics.

Usage

stat_composite_mle(
  data,
  n,
  pdf,
  cdf,
  sf = NULL,
  params,
  censoring = c("right", "left"),
  transform = c("malmquist", "ms"),
  optim_control = list()
)

Arguments

data

Numeric vector of observed order statistics.

n

Total sample size (n >= length(data)).

pdf

Probability density function taking (x, params).

cdf

Cumulative distribution function taking (x, params).

sf

Survival function taking (x, params). If NULL, computed as 1 - cdf(x, params).

params

Named list/vector of starting parameter values for MLE.

censoring

Type of censoring: "right" or "left".

transform

Transformation method: "ms" (Michael-Schucany) or "malmquist".

optim_control

Optional control list passed to optim.

Value

A list containing:

stat_W2

Modified Cramér-von Mises statistic (_mW2 or _lW2).

stat_A2

Modified Anderson-Darling statistic (_mA2 or _lA2).

W2

Raw Cramér-von Mises statistic on standardized residuals.

A2

Raw Anderson-Darling statistic on standardized residuals.

theta_hat

Estimated parameter values.

convergence

Optimization convergence code.

Examples

data_exp <- c(0.1, 0.2, 0.3, 0.4, 0.7, 1.0, 1.4)
stat_composite_mle(
  data = data_exp, n = 20,
  pdf = function(x, p) dexp(x, rate = p$rate),
  cdf = function(x, p) pexp(x, rate = p$rate),
  params = list(rate = 0.1),
  censoring = "right",
  transform = "malmquist"
)

Compute Direct Censored EDF Statistics (Pettitt & Stephens, 1976)

Description

Computes the untransformed direct censored Cramér-von Mises and Anderson-Darling statistics.

Usage

stat_direct_censored(u_cens, n)

Arguments

u_cens

Numeric vector of order statistics u_1:n < ... < u_r:n in (0, 1).

n

Total sample size (n >= length(u_cens)).

Value

Named numeric vector containing W2_2_rn and A2_2_rn.

Examples

u <- c(0.03, 0.06, 0.10, 0.11, 0.13)
stat_direct_censored(u, n = 10)

Compute EDF Statistics for Type-II Censored Samples

Description

Computes the nine EDF test statistics described in Lin, Huang & Balakrishnan (2008).

Usage

stat_edf_censored(u_cens, n, u_ms = NULL, u_malmquist = NULL)

Arguments

u_cens

Numeric vector of order statistics u_1:n < ... < u_r:n in (0, 1).

n

Total sample size (n >= length(u_cens)).

u_ms

Optional pre-computed Michael & Schucany transformed sample.

u_malmquist

Optional pre-computed Malmquist transformed sample.

Value

A named numeric vector of 9 statistics: D_rn, G_rn, T_rn, W2_star_rn, W2_rn, A2_rn, U2_rn, TA2_r, and star_TA2_r.

Examples

u <- c(0.03, 0.06, 0.10, 0.11, 0.13)
stat_edf_censored(u, n = 10)

Malmquist (1950) Transformation for Type-II Censored Samples

Description

Converts an r-out-of-n Type-II right- or left-censored uniform sample into an independent complete Uniform(0,1) sample of size r (Lin, Huang & Balakrishnan, 2008).

Usage

transform_malmquist(u_cens, n, censoring = c("right", "left"))

Arguments

u_cens

Numeric vector of length r containing PIT-transformed order statistics.

n

Total sample size (n >= length(u_cens)).

censoring

Type of censoring: "right" or "left".

Value

A list containing:

W

Sorted complete sample W_1:r < ... < W_r:r of size r.

V

Vector of intermediate Beta-distributed random variables V_n, ..., V_{n-r+1}.

Examples

u <- c(0.03, 0.06, 0.10, 0.11, 0.13)
transform_malmquist(u, n = 10, censoring = "right")

Michael & Schucany (1979) Transformation

Description

Transforms an r-out-of-n Type-II right-censored uniform sample into a complete sample of size r.

Usage

transform_ms(u_cens, n)

Arguments

u_cens

Numeric vector of order statistics u_1:n < ... < u_r:n in (0, 1).

n

Total sample size (n >= length(u_cens)).

Value

Numeric vector of length r representing the transformed complete sample Z_1:r < ... < Z_r:r.

Examples

u <- c(0.03, 0.06, 0.10, 0.11, 0.13)
transform_ms(u, n = 10)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.