R/mom.R

Defines functions triangle_mom

Documented in triangle_mom

#' Triangle distribution method of moments estimate
#'
#' @param x triangle distribution sample
#'
#' @return a vector of the parameter estimates
#' @export
#'
#' @examples
#' set.seed(1204)
#' x <- rtriangle(20, 0, 2, 1.5)
#' triangle_mom(x)
triangle_mom <- function(x)
{
  ap <- min(x)
  bp <- max(x)
  cp <- 3*mean(x) - ap - bp
  return(c(ap, bp, cp))
}

Try the triangle package in your browser

Any scripts or data that you put into this service are public.

triangle documentation built on Dec. 28, 2022, 2:09 a.m.