% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mle.R
\name{fit_mle}
\alias{fit_mle}
\title{Maximum Likelihood Estimation for Type-II Censored Samples}
\usage{
fit_mle(
  data,
  n,
  pdf,
  cdf,
  sf = NULL,
  params,
  censoring = c("right", "left"),
  optim_control = list()
)
}
\arguments{
\item{data}{Numeric vector of length \code{r}, sorted ascending.}

\item{n}{Total sample size (\code{n >= r}).}

\item{pdf}{Probability density function.}

\item{cdf}{Cumulative distribution function.}

\item{sf}{Survival function. If \code{NULL}, computed as \code{1 - cdf(x, params)}.}

\item{params}{Named list or vector of starting parameter values.}

\item{censoring}{Type of censoring: \code{"right"} or \code{"left"}.}

\item{optim_control}{Optional control list passed to \code{\link[stats]{optim}}.}
}
\value{
A list containing \code{par} (estimated parameters), \code{value} (negative log-likelihood),
\code{convergence} status code, and \code{message}.
}
\description{
Estimates distribution parameters under Type-II right- or left-censoring.
}
\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
}
