internal: Internal Functions: Helpers

internalR Documentation

Internal Functions: Helpers

Description

Exported functions intended to be used internally.

'%>%': imported function, see magrittr::%>% for details.

Usage

rZINB(N, mu.nb, theta.nb, phi.zi)

r0truncpois(n, lambda)

r0truncnegbin(n, lambda, theta)

rHurdle(N, mu.nb, theta.nb, phi.zi)

solvenear(x)

find_mode(x)

lhs %>% rhs

Arguments

N, n

The number of random numbers to produce.

mu.nb, lambda

The mean of the NB distribution.

theta.nb, theta

The dispersion parameter of the NB distribution, a single non-negative numeric value or 'NULL' (this refers to no overdispersion, thus a Poisson or ZIP distribution).

phi.zi

The probability of the non-zero valies in the ZI part.

x

A symmetric square matrix for 'solvenear', a numeric vector for 'find_mode'.

lhs

A value or the magrittr placeholder.

rhs

A function call using the magrittr semantics.

Details

'ZINB' makes zero inflated negative binomial random numbers.

'solvenear' inverts near-PD matrices. It function makes sure that near-positive definite matrices are positive definite. Positive definiteness is needed for matrix inversion, which in turn is used to find the Hessian matrix and standard errors for model coefficients from numerical optimization.

The 'find_mode' function finds the mode of a distribution using one-dimensional kernel density estimation. The density based estimate is rounded, because the function is used in the context of count data models and predictions.

Value

The result of calling 'rhs(lhs)'.

Examples

table(rZINB(100, 3, 2, 0.5))
table(rZINB(100, 3, NULL, 0.5))

x <- c(1, 2, 1, 3, 4, 3, 2, 3, 5, 6, 10)
find_mode(x)
plot(density(x))
rug(x)
abline(v = find_mode(x), lty=2)


psolymos/moosecounter documentation built on Feb. 25, 2024, 4:43 p.m.