% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plotly_mcf.R
\name{plotly_mcf}
\alias{plotly_mcf}
\title{Interactive Mean Cumulative Function Plot.}
\usage{
plotly_mcf(
  mcf_obj,
  showConf = TRUE,
  showGrid = TRUE,
  main = "Mean Cumulative Function Plot",
  xlab = "Time",
  ylab = "Mean Cumulative Function",
  fitCol = "black",
  confCol = "black",
  gridCol = "lightgray",
  signif = 3,
  cols = NULL
)
}
\arguments{
\item{mcf_obj}{An object of class 'mcf', or a list of such objects. Each
object is created using the `mcf()` function from the `ReliaGrowR` package.}

\item{showConf}{Show the confidence bounds (TRUE) or not (FALSE). Default is TRUE.}

\item{showGrid}{Show grid (TRUE) or hide grid (FALSE). Default is TRUE.}

\item{main}{Main title. Default is "Mean Cumulative Function Plot".}

\item{xlab}{X-axis label. Default is "Time".}

\item{ylab}{Y-axis label. Default is "Mean Cumulative Function".}

\item{fitCol}{Color of the MCF step function. Default is "black". Used only
for a single mcf object; ignored when `cols` is provided or multiple objects
are supplied.}

\item{confCol}{Color of the confidence bounds. Default is "black". Used only
for a single mcf object; ignored when `cols` is provided or multiple objects
are supplied.}

\item{gridCol}{Color of the grid. Default is "lightgray".}

\item{signif}{Significant digits of results. Default is 3. Must be a positive integer.}

\item{cols}{Optional character vector of colors, one per mcf object. When
provided, each object's step function and confidence bounds are drawn in the
corresponding color. Recycled if shorter than the number of objects.}
}
\value{
A `plotly` object representing the interactive MCF plot.
}
\description{
The function creates an interactive Mean Cumulative Function (MCF) plot for
one or more `mcf` objects. When a list of objects is provided the models are
overlaid on the same plot, each rendered in a distinct color.
The MCF is rendered as a step function. Optional confidence bounds are shown
as a shaded band around the estimate.
}
\details{
The MCF is a nonparametric estimate of the expected cumulative number of
events per system by time \eqn{t}. It is computed from recurrence data
(multiple events per system) and rendered as a step function. The slope
of the MCF at any point approximates the current event rate (repairs per
unit time). Confidence bounds are computed using the Nelson variance
estimator.
}
\examples{
library(ReliaGrowR)
ids <- c("A", "A", "A", "B", "B", "C", "C", "C", "C")
times <- c(50, 150, 350, 100, 300, 80, 200, 320, 450)
fit <- mcf(id = ids, time = times)
plotly_mcf(fit)

# Overlay two MCF objects
fit2 <- mcf(id = c("X", "X", "Y"), time = c(60, 220, 180))
plotly_mcf(list(fit, fit2), cols = c("steelblue", "tomato"))
}
\seealso{
[plotly_nhpp()] to overlay a parametric Power Law model on the MCF;
[plotly_exposure()] for the cumulative event rate.
}
