---
title: "Lindley Approximation Method for Generalized Process Capability Indices under Progressive Type-II Censoring"
author: "Shikhar Tyagi, Sumit Kumar, Arvind Pandey, Bhupendra Singh, Vrijesh Tripathi"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Lindley Approximation Method for Generalized Process Capability Indices under Progressive Type-II Censoring}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(gpciLindApproxProgII)
```

## Introduction

The **`gpciLindApproxProgII`** package provides a Bayesian statistical framework for computing **Generalized Process Capability Indices (GPCIs)** under **Progressive Type-II Censored Data** using **Lindley's 3rd-order Approximation Method**.

## Progressive Type-II Censoring Model

Let $n$ units be placed on test and $m$ failure times $X = (x_1, x_2, \dots, x_m)$ be observed under progressive removal scheme $R = (R_1, R_2, \dots, R_m)$. The progressive log-likelihood function is:

$$\ell(\theta) = \sum_{i=1}^m \log f(x_i; \theta) + \sum_{i=1}^m R_i \log S(x_i; \theta)$$

## Example Analysis

Below is a demonstration of fitting progressive Type-II failure data with custom user functions or built-in distributions.

```{r example}
# Failure times and progressive removal scheme
x <- c(0.5, 1.2, 2.1, 3.4, 4.8)
r <- c(1, 0, 2, 0, 1)

# Fit model using Lindley approximation and chain generation
fit <- lindley_prog_gpci(
  x = x,
  r_removals = r,
  distribution = dist_weibull(),
  USL = 6, LSL = 0,
  chain_length = 200,
  burn_in = 50,
  thinning = 1,
  B = 50
)

# Print Summary Table
summary(fit)
```

## Plotting Results

```{r plot-fit, fig.width=7, fig.height=5}
plot(fit)
```
