| Title: | Efficient eM-Algorithm for One-Shot Device Data Analysis |
|---|---|
| Description: | Implements the simple and efficient Expectation-Maximization (eM) algorithm proposed by Zhu, Li, Li, and Balakrishnan (2026) <doi:10.1080/03610918.2025.2515193> for parameter estimation in one-shot device accelerated life testing (ALT) data. Unlike traditional EM algorithms that impute exact failure times, this method treats failure counts between inspection intervals as missing data, resulting in faster convergence and enhanced numerical stability. Supports Exponential, Weibull, Lognormal, Gamma, and custom user-defined lifetime distributions under log-linear stress models. Standard errors, confidence intervals, model selection statistics (AIC, BIC, AICc, HQIC), residual diagnostics, and visualization tools are provided. References: Balakrishnan and Ling (2012) <doi:10.1016/j.csda.2011.09.010>, Fan, Balakrishnan, and Chang (2009) <doi:10.1080/00949650802142592>. |
| Authors: | Shikhar Tyagi [aut, cre] (ORCID: <https://orcid.org/0000-0003-1606-0844>), Arvind Pandey [aut], Bhupendra Singh [aut], Vrijesh Tripathi [aut] |
| Maintainer: | Shikhar Tyagi <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.1.0 |
| Built: | 2026-09-21 09:40:17 UTC |
| Source: | https://github.com/cran/OneShotEM |
Extract Akaike Information Criterion (AIC)
## S3 method for class 'oneshot_em' AIC(object, ..., k = 2)## S3 method for class 'oneshot_em' AIC(object, ..., k = 2)
object |
an object of class |
... |
optional additional objects. |
k |
penalty per parameter (default: 2). |
A numeric scalar of class "numeric" containing the calculated Akaike Information Criterion (AIC) value for the fitted model.
Extract Bayesian Information Criterion (BIC)
## S3 method for class 'oneshot_em' BIC(object, ...)## S3 method for class 'oneshot_em' BIC(object, ...)
object |
an object of class |
... |
optional additional objects. |
A numeric scalar of class "numeric" containing the calculated Bayesian Information Criterion (BIC) value for the fitted model.
Extract Model Coefficients
## S3 method for class 'oneshot_em' coef(object, ...)## S3 method for class 'oneshot_em' coef(object, ...)
object |
an object of class |
... |
additional arguments (unused). |
A named numeric vector of class "numeric" containing the maximum likelihood estimates of the model parameters.
One-shot device accelerated life test (ALT) dataset reported by Fan, Balakrishnan, and Chang (2009) and analyzed by Zhu et al. (2026).
data(electro_explosive)data(electro_explosive)
A data frame with 9 rows and 4 variables:
temperature stress setting in degrees Celsius (35, 45, 55)
inspection time in hours (10, 20, 30)
number of devices tested at the specified inspection time (10 per row, total 90)
number of observed device failures at inspection
Fan, T., Balakrishnan, N., & Chang, C. (2009). The Bayesian approach for highly reliable electro-explosive devices using one-shot device testing. Journal of Statistical Computation and Simulation, 79(9), 1143–1154. doi:10.1080/00949650802142592
Zhu, X., Li, Y., Li, T., & Balakrishnan, N. (2026). A simple and efficient eM-algorithm for one-shot device data analysis. Communications in Statistics - Simulation and Computation, 55(3), 959–970. doi:10.1080/03610918.2025.2515193
data(electro_explosive) head(electro_explosive)data(electro_explosive) head(electro_explosive)
Sets control parameters for the Expectation-Maximization algorithms.
em_control( maxit = 1000, tol = 1e-06, trace = FALSE, optimizer = c("nlm", "optim"), max_m_iter = 100, reltol = 1e-10 )em_control( maxit = 1000, tol = 1e-06, trace = FALSE, optimizer = c("nlm", "optim"), max_m_iter = 100, reltol = 1e-10 )
maxit |
maximum number of EM iterations (default: 1000). |
tol |
convergence tolerance based on maximum relative difference between parameter iterations (default: 1e-6). |
trace |
logical; if |
optimizer |
optimization method for the M-step, either |
max_m_iter |
maximum iterations for the inner M-step optimization (default: 100). |
reltol |
relative tolerance for M-step optimizer (default: 1e-10). |
A list containing the control options.
ctrl <- em_control(maxit = 500, tol = 1e-5, trace = FALSE)ctrl <- em_control(maxit = 500, tol = 1e-5, trace = FALSE)
Extract Log-Likelihood
## S3 method for class 'oneshot_em' logLik(object, ...)## S3 method for class 'oneshot_em' logLik(object, ...)
object |
an object of class |
... |
additional arguments (unused). |
An object of class "logLik" representing the maximized log-likelihood value, with additional attributes "df" (degrees of freedom / number of estimated parameters) and "nobs" (total number of tested devices).
Fits lifetime models for one-shot device data using the new expectation-maximization (eM) algorithm proposed by Zhu et al. (2026).
oneshot_em( formula, data, it = "it", dist = c("exponential", "weibull", "lognormal", "gamma", "custom"), sf_fun = NULL, theta0 = NULL, control = em_control() )oneshot_em( formula, data, it = "it", dist = c("exponential", "weibull", "lognormal", "gamma", "custom"), sf_fun = NULL, theta0 = NULL, control = em_control() )
formula |
an object of class |
data |
a data frame containing the variables in the model. |
it |
character string or vector specifying inspection time variable. If |
dist |
lifetime distribution name: |
sf_fun |
custom survival function of signature |
theta0 |
numeric vector of initial parameter values. If omitted, calculated automatically. |
control |
list of control parameters from |
An object of class "oneshot_em" containing:
coefficients |
estimated model parameters |
loglik |
maximized log-likelihood value |
iterations |
number of EM iterations to convergence |
converged |
logical indicating successful convergence |
vcov |
variance-covariance matrix |
std_err |
standard errors of parameter estimates |
dist |
distribution used |
method |
"npm" (new proposed method) |
data |
input data frame |
formula |
model formula |
terms |
model terms object |
control |
control list |
Zhu, X., Li, Y., Li, T., & Balakrishnan, N. (2026). A simple and efficient eM-algorithm for one-shot device data analysis. Communications in Statistics - Simulation and Computation, 55(3), 959–970. doi:10.1080/03610918.2025.2515193
data(electro_explosive) fit_exp <- oneshot_em(cbind(r, n) ~ temp, data = electro_explosive, it = "it", dist = "exponential") summary(fit_exp)data(electro_explosive) fit_exp <- oneshot_em(cbind(r, n) ~ temp, data = electro_explosive, it = "it", dist = "exponential") summary(fit_exp)
Unified high-level fitting interface for one-shot device accelerated life test data.
oneshot_fit( formula, data, it = "it", dist = c("exponential", "weibull", "lognormal", "gamma", "custom"), method = c("npm", "tm"), sf_fun = NULL, theta0 = NULL, control = em_control() )oneshot_fit( formula, data, it = "it", dist = c("exponential", "weibull", "lognormal", "gamma", "custom"), method = c("npm", "tm"), sf_fun = NULL, theta0 = NULL, control = em_control() )
formula |
an object of class |
data |
a data frame containing the variables in the model. |
it |
character string or vector specifying inspection time variable. If |
dist |
lifetime distribution name: |
method |
estimation method: |
sf_fun |
custom survival function of signature |
theta0 |
numeric vector of initial parameter values. If omitted, calculated automatically. |
control |
list of control parameters from |
An object of class "oneshot_em" containing model fitting results (see oneshot_em for full list of output elements).
data(electro_explosive) fit <- oneshot_fit(cbind(r, n) ~ temp, data = electro_explosive, it = "it", dist = "weibull", method = "npm") print(fit)data(electro_explosive) fit <- oneshot_fit(cbind(r, n) ~ temp, data = electro_explosive, it = "it", dist = "weibull", method = "npm") print(fit)
Computes standardized Pearson residuals and randomized quantile residuals for one-shot device data models.
oneshot_residuals(fit)oneshot_residuals(fit)
fit |
an object of class |
A data frame containing:
observed |
observed failure count |
expected |
expected failure count |
pearson |
standardized Pearson residual |
quantile |
randomized quantile residual |
data(electro_explosive) fit <- oneshot_em(cbind(r, n) ~ temp, data = electro_explosive, it = "it") res <- oneshot_residuals(fit) head(res)data(electro_explosive) fit <- oneshot_em(cbind(r, n) ~ temp, data = electro_explosive, it = "it") res <- oneshot_residuals(fit) head(res)
Fits lifetime models for one-shot device data using the traditional failure-time expectation-maximization (EM)
algorithm for comparison with the new eM-algorithm (oneshot_em).
oneshot_tm( formula, data, it = "it", dist = c("exponential", "weibull", "lognormal", "gamma", "custom"), sf_fun = NULL, theta0 = NULL, control = em_control() )oneshot_tm( formula, data, it = "it", dist = c("exponential", "weibull", "lognormal", "gamma", "custom"), sf_fun = NULL, theta0 = NULL, control = em_control() )
formula |
an object of class |
data |
a data frame containing the variables in the model. |
it |
character string or vector specifying inspection time variable. If |
dist |
lifetime distribution name: |
sf_fun |
custom survival function of signature |
theta0 |
numeric vector of initial parameter values. If omitted, calculated automatically. |
control |
list of control parameters from |
An object of class "oneshot_em" fitted via the traditional EM approach, containing:
coefficients |
estimated model parameters |
loglik |
maximized log-likelihood value |
iterations |
number of EM iterations to convergence |
converged |
logical indicating successful convergence |
vcov |
variance-covariance matrix |
std_err |
standard errors of parameter estimates |
dist |
distribution used |
method |
"tm" (traditional method) |
data |
input data frame |
formula |
model formula |
terms |
model terms object |
control |
control list |
Balakrishnan, N., & Ling, M. (2012). EM algorithm for one-shot device testing under the exponential distribution. Computational Statistics & Data Analysis, 56(3), 502–509.
data(electro_explosive) fit_tm <- oneshot_tm(cbind(r, n) ~ temp, data = electro_explosive, it = "it", dist = "exponential") summary(fit_tm)data(electro_explosive) fit_tm <- oneshot_tm(cbind(r, n) ~ temp, data = electro_explosive, it = "it", dist = "exponential") summary(fit_tm)
Generates fitted survival curves, empirical vs fitted failure proportions, or residual plots.
## S3 method for class 'oneshot_em' plot(x, type = c("fitted", "survival", "residuals"), ...)## S3 method for class 'oneshot_em' plot(x, type = c("fitted", "survival", "residuals"), ...)
x |
an object of class |
type |
plot type: |
... |
additional graphical parameters. |
Invisibly returns the original input object x of class "oneshot_em". This function is called for its side effect of producing graphical diagnostic plots (fitted vs observed failure rates, survival curves, or standardized residuals).
Predicts survival probability or Mean Time To Failure (MTTF) under specified stress levels.
## S3 method for class 'oneshot_em' predict(object, newdata = NULL, time = NULL, type = c("survival", "mttf"), ...)## S3 method for class 'oneshot_em' predict(object, newdata = NULL, time = NULL, type = c("survival", "mttf"), ...)
object |
an object of class |
newdata |
data frame containing new stress levels. |
time |
numeric vector of inspection times for survival prediction. |
type |
prediction type: |
... |
additional arguments (unused). |
A numeric vector or matrix of class "numeric" containing predicted survival probabilities (when type = "survival") or Mean Time To Failure (MTTF) values (when type = "mttf") calculated under the specified stress levels and times.
Print Method for One-Shot Device EM Fit
## S3 method for class 'oneshot_em' print(x, digits = max(3L, getOption("digits") - 3L), ...)## S3 method for class 'oneshot_em' print(x, digits = max(3L, getOption("digits") - 3L), ...)
x |
an object of class |
digits |
number of significant digits to print. |
... |
additional arguments (unused). |
Invisibly returns the original input object x of class "oneshot_em". This function is called primarily for its side effect of printing model fit summary information (distribution, convergence status, estimated coefficients, log-likelihood) to the console.
Print Method for Summary of One-Shot Device EM Fit
## S3 method for class 'summary.oneshot_em' print(x, digits = max(3L, getOption("digits") - 3L), ...)## S3 method for class 'summary.oneshot_em' print(x, digits = max(3L, getOption("digits") - 3L), ...)
x |
an object of class |
digits |
number of significant digits to print. |
... |
additional arguments (unused). |
Invisibly returns the summary object x of class "summary.oneshot_em". This function is called primarily for its side effect of formatting and printing model summary results, coefficient matrices, and information criteria to the console.
Computes summary statistics including standard errors, z-values, p-values, 95% Wald confidence intervals, and model selection criteria.
## S3 method for class 'oneshot_em' summary(object, level = 0.95, ...)## S3 method for class 'oneshot_em' summary(object, level = 0.95, ...)
object |
an object of class |
level |
confidence level for confidence intervals (default: 0.95). |
... |
additional arguments (unused). |
An object of class "summary.oneshot_em", which is a list containing the following components:
coefficients |
a matrix of parameter estimates, standard errors, z-values, p-values, and confidence intervals |
loglik |
maximized log-likelihood value |
npar |
number of estimated parameters |
nobs |
total number of tested devices |
aic |
Akaike Information Criterion |
bic |
Bayesian Information Criterion |
aicc |
corrected Akaike Information Criterion |
hqic |
Hannan-Quinn Information Criterion |
iterations |
number of EM iterations executed |
converged |
logical flag indicating convergence status |
dist |
fitted lifetime distribution name |
method |
estimation algorithm name ("npm" or "tm") |
call_object |
original fitted |
Extract Variance-Covariance Matrix
## S3 method for class 'oneshot_em' vcov(object, ...)## S3 method for class 'oneshot_em' vcov(object, ...)
object |
an object of class |
... |
additional arguments (unused). |
A symmetric numeric matrix of class "matrix" representing the estimated variance-covariance matrix of the parameter estimates.