lnorm2_PCC | R Documentation |

lnorm2_PCC is used to derive the Predictive Control Chart (PCC) for LogNormal data, when the shape parameter is unknown and the scale parameter is known.

```
lnorm2_PCC(data = NULL, historical_data = NULL,
ml = NULL, a0 = 0, b0 =0, alpha_0 = NULL,
ARL_0 = 370.4, FAP = NULL, FIR = FALSE, fFIR = .99, aFIR = 1/8,
summary_list = TRUE, PCC_PLOT = TRUE, PriorPosterior_PLOT = FALSE,
historical_data_PLOT = FALSE, pdf_report = FALSE, path_pdf_report = tempdir(),
xlab = "Observation Order", ylab = "Quality characteristic Values",
main = "PCC LogNormal with unknown variance")
```

`data` |
vector; a dataset for PCC implementation. Data needs to be in a vector form. |

`historical_data` |
vector; an optional dataset of historical data. Historical data needs to be in a vector form. |

`ml` |
scalar; parameter of the likelihood. It is the known mean of the data and needs to be a number. |

`a0` |
scalar (positive); hyperparameter of the prior IG(a0, b0). It needs to be a number. The default is 0 and it refers to the initial reference prior IG(0, 0). |

`b0` |
scalar (positive); hyperparameter of the prior IG(a0, b0). It needs to be a number. The default is 0 and it refers to the initial reference prior IG(0, 0). |

`alpha_0` |
scalar (non negative); It is a power prior parameter controlling the influence of the historical data on the posterior distribution. The default is 1/n_0, where n_0 is the size of the historical data. |

`ARL_0` |
scalar (positive); In Control (IC) Average Run Length (ARL). It is average number of IC data points that we will plot in the PCC before a false alarm occurs. The default value is 370.4 |

`FAP` |
scalar (between 0 and 1); False Alarm Probability (FAP). It is the probability of raising at least one false alarm out of a pre-determined number of N hypothesis tests and it can be used instead of ARL_0. It is based on the Sidak's correction. |

`FIR` |
logical; If TRUE, then the Fast Initial Response (FIR) PCC is applied, which is an adjustment (narrows the PCC limits) for the initial fisrt tests. |

`fFIR` |
a number between 0 and 1; It is used if FIR=TRUE. The default value is 0.99 and represents the proportion of the adjusted PCC region over the initial one for the first test. |

`aFIR` |
non-negative number; It is used if FIR=TRUE. The default value is 0.125 and it is a smoothing parameter for the FIR adjustment. |

`summary_list` |
logical; If it is TRUE, then a data frame is provided, containing the data sequence, the PCC limits along with the possible occurence of an alarm. It is TRUE by default. |

`PCC_PLOT` |
logical; if TRUE, the PCC plot is displayed. It is TRUE by default. |

`PriorPosterior_PLOT` |
logical; if TRUE, the Prior and Posterior distribution(s) of the parameter(s) are displayed. It is TRUE by default. |

`historical_data_PLOT` |
logical; if TRUE, the historical data are plotted precending the PCC plot. It is FALSE by default. |

`pdf_report` |
logical; if TRUE then the summary list, PCC plot and Prior/Posterior distribution(s) of the parameter(s) are reported in a pdf file. |

`path_pdf_report` |
specified path to save pdf report if pdf_report=TRUE. The default path is the temporary direction tempdir(). |

`xlab, ylab, main` |
The titles of the x-axis, y-axis and the overall title for the PCC plot. The default values are "Observation Order", "Quality characteristic Values" and "PCC LogNormal with unknown variance" respectively |

lnorm2_PCC provides the Predictive Control Chart (PCC) process for LogNormal data, when the shape parameter is unknown and the scale parameter is known. The PCC process is based on the sequential testing of the future observable against the Highest Predictive Density (HPrD), which is obtained by the posterior predictive distribution. The PCC testing starts as early as the second observation.

The initial prior for the unknown shape parameter is an Inverse Gamma: IG(a0, b0). Furthermore, the direct use of available historical data is possible via the power prior, if they are available. In this case, the default value for the power prior parameter alpha_0 is the reciprocal of the length of the historical data, which conveys the weight of a single observation to the prior information. The default prior is the non-informative reference prior IG(0, 0), without the use of historical data.

A FIR option is available by narrowing the first few control limits. The metrics that can be used to control the false alarms tolerance are either ARL_0 or FAP.

Runs the PCC process, while if FIR=T, then the FIR-PCC is implemented. If plot=T, then a data frame is provided with the data, the upper and the lower limits of the Highest Predictive Density or Mass (HPrD/M) region, and an indication in case of alarms. If PCC_PLOT=T, then the PCC process is visualized, while if historical_data_PLOT=T, the historical data are added to the plot. If PriorPosterior_PLOT = T, a plot with the prior and the posterior is provided. Finally, if pdf_report=T, all the output is reported and saved into a pdf file.

```
# 30 LogNormal observations introducing an outlier at the 15th observation
set.seed(1)
SimData <- rlnorm(n = 30, meanlog = 0, sdlog = 1/2)
SimData[15] <- SimData[15] + 3*sqrt( exp(1/4)*( exp(1/4)-1 ) )
plot(SimData)
lnorm2_PCC(SimData, ml = 0)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.