fit_params {scModels}R Documentation

Functions to estimate parameters of probability distributions by fitting the distributions using optim()

Description

Functions to estimate parameters of probability distributions by fitting the distributions using optim()

Usage

fit_params(x, type, optim_control = list(maxit = 1000))

Arguments

x

Vector containing the discrete observations

type

Keyword for the probability distribution the data is to be fitted against. Possible values are ("pois", "nb", "del", pig", "pb", "pois2", "nb2", "del2", "pig2" "pb2", "zipois", "zinb", "zidel", "zipg", zipb", "zipois2", "zinb2", "zidel2", "zipig2", zipb2")

optim_control

List of options to override presets in the optim function; Set to list(maxit = 1000) by default. For more details, please refer to the 'control' parameter in the standard 'optim' function in package 'stats'.

Examples

x1 <- rnbinom(100, size = 13, mu = 9)
p1 <- fit_params(x1, "nb")
s <- sample(x = c(0,1), size = 100, replace = TRUE, prob = c(0.3,0.7))
x2 <- s*x1 + (1-s) * rnbinom(100, size = 15, mu = 53)
p2 <- fit_params(x2, "nb2")

[Package scModels version 1.0.4 Index]