newFit: newFit

View source: R/fraping.R

newFitR Documentation

newFit

Description

Create a new instance of the "Fit" class for a given function.

Usage

newFit(name, fun, param, interval)

Arguments

name

Name of the fit.

fun

The fitting function.

param

The parameter(s) of the fitting function.

interval

The interval(s) for each parameter.

Value

An instance of the "Fit" class.

Examples

# Create a new Fit object for the Exponential distribution
fit_exp <- newFit("Exponential", pexp, "rate", list(c(0, 1)))

# Create a new Fit object for the Pareto distribution
ppareto <- function(x, shape, scale) {
  if (any(x < scale)) return(rep(0, length(x)))
  shape * scale^shape / x^(shape + 1)
}
fit_pareto <- newFit("Pareto", ppareto, c("shape", "scale"), list(c(0, 5), c(0, 100)))


artitzco/fraping documentation built on June 1, 2024, 10:08 a.m.