| Title: | Likelihood Exploration |
|---|---|
| Description: | Provides likelihood functions as defined by Fisher (1922) <doi:10.1098/rsta.1922.0009> and a function that creates likelihood functions from density functions. The functions are meant to aid in education of likelihood based methods. |
| Authors: | Ben Barnard [aut, cre] |
| Maintainer: | Ben Barnard <[email protected]> |
| License: | GPL-2 |
| Version: | 0.1.1 |
| Built: | 2026-05-29 11:23:30 UTC |
| Source: | https://github.com/benbarnard/likelihoodexplore |
The log likelihood of a beta density with data, x, shape1, shape2 and ncp parameters.
likbeta(shape1, shape2, ncp = 0, x, log = FALSE)likbeta(shape1, shape2, ncp = 0, x, log = FALSE)
shape1 |
non-negative parameters of the Beta distribution. |
shape2 |
non-negative parameters of the Beta distribution. |
ncp |
non-centrality parameter. |
x |
vector of quantiles. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the beta density given the data where shape1, shape2, and ncp can be held constant or if vector were given vector will be returned.
likbeta(x = rbeta(n = 2, shape1 = 3, shape2 = 4), shape1 = 3, shape2 = 4)likbeta(x = rbeta(n = 2, shape1 = 3, shape2 = 4), shape1 = 3, shape2 = 4)
The log likelihood of a binomial density with data, x, size and prob parameters.
likbinom(size, prob, x, log = FALSE)likbinom(size, prob, x, log = FALSE)
size |
number of trials (zero or more). |
prob |
probability of success on each trial. |
x |
vector of quantiles. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the binomial density given the data where size and prob can be held constant or if vector were given vector will be returned.
likbinom(x = rbinom(n = 2, size = 3, prob = .4), size = 3, prob = .4)likbinom(x = rbinom(n = 2, size = 3, prob = .4), size = 3, prob = .4)
The log likelihood of a Cauchy density with data, x, location and scale parameters.
likcauchy(location = 0, scale = 1, x, log = FALSE)likcauchy(location = 0, scale = 1, x, log = FALSE)
location |
location and scale parameters. |
scale |
location and scale parameters. |
x |
vector of quantiles. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the Cauchy density given the data where location and scale can be held constant or if vector were given vector will be returned.
likcauchy(x = rcauchy(n = 2))likcauchy(x = rcauchy(n = 2))
The log likelihood of a chi-squared density with data, x, df and ncp parameters.
likchisq(df, ncp = 0, x, log = FALSE)likchisq(df, ncp = 0, x, log = FALSE)
df |
degrees of freedom (non-negative, but can be non-integer). |
ncp |
non-centrality parameter (non-negative). |
x |
vector of quantiles. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the chi-squared density given the data where df and ncp can be held constant or if vector were given vector will be returned.
likchisq(x = rchisq(n = 2, df = 4), df = 4)likchisq(x = rchisq(n = 2, df = 4), df = 4)
Function that creates a log likelihood function given a density function density.
likelihood(density, ...)likelihood(density, ...)
density |
density function used |
... |
other options |
The log likelihood is the log of a function of parameters given the data.
A function that is the log likelihood function from density function density.
likelihood(dnorm, x = rnorm(100))likelihood(dnorm, x = rnorm(100))
A package of likelihood functions as defined by Fisher <doi:10.1098/rsta.1922.0009> and a function that creates likelihood functions from density functions. The functions are meant to aid in education of likelihood based methods.
The log likelihood of a exponential density with data, x, rate parameter.
likexp(rate = 1, x, log = FALSE)likexp(rate = 1, x, log = FALSE)
rate |
vector of rates. |
x |
vector of quantiles. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the exponential density given the data where rate can be held constant or if vector were given vector will be returned.
likexp(x = rexp(n = 2))likexp(x = rexp(n = 2))
The log likelihood of a F density with data, x, df1, df2 and ncp parameters.
likf(df1, df2, ncp, x, log = FALSE)likf(df1, df2, ncp, x, log = FALSE)
df1 |
degrees of freedom. |
df2 |
degrees of freedom. |
ncp |
non-centrality parameter. If omitted the central F is assumed. |
x |
vector of quantiles. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the f density given the data where df1, df2, and ncp can be held constant or if vector were given vector will be returned.
likf(x = rf(n = 2, df1 = 3, df2 = 4), df1 = 3, df2 = 4, ncp = 0)likf(x = rf(n = 2, df1 = 3, df2 = 4), df1 = 3, df2 = 4, ncp = 0)
The log likelihood of a gamma density with data, x, shape, rate and scale parameters.
likgamma(shape, rate = 1, scale = 1/rate, x, log = FALSE)likgamma(shape, rate = 1, scale = 1/rate, x, log = FALSE)
shape |
shape and scale parameters. Must be positive,
|
rate |
an alternative way to specify the scale. |
scale |
shape and scale parameters. Must be positive,
|
x |
vector of quantiles. |
log |
logical; if |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the gamma density given the data where shape, scale, and rate can be held constant or if vector were given vector will be returned.
likgamma(x = rgamma(n = 2, shape = 3), shape = 3)likgamma(x = rgamma(n = 2, shape = 3), shape = 3)
The log likelihood of a geometric density with data, x, prob parameter.
likgeom(prob, x, log = FALSE)likgeom(prob, x, log = FALSE)
prob |
probability of success in each trial. |
x |
vector of quantiles representing the number of failures in a sequence of Bernoulli trials before success occurs. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the geometric density given the data where prob can be held constant or if vector were given vector will be returned.
likgeom(x = rgeom(n = 2, prob = .4), prob = .4)likgeom(x = rgeom(n = 2, prob = .4), prob = .4)
The log likelihood of a hypergeometric density with data, x, m, n and k parameters.
likhyper(m, n, k, x, log = FALSE)likhyper(m, n, k, x, log = FALSE)
m |
the number of white balls in the urn. |
n |
the number of black balls in the urn. |
k |
the number of balls drawn from the urn. |
x |
vector of quantiles representing the number of white balls drawn without replacement from an urn which contains both black and white balls. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the hypergeometric density given the data where m, n, and k can be held constant or if vector were given vector will be returned.
likhyper(x = rhyper(nn = 2, m = 3, n = 4, k = 2), m = 3, n = 4, k = 2)likhyper(x = rhyper(nn = 2, m = 3, n = 4, k = 2), m = 3, n = 4, k = 2)
The log likelihood of a log normal density with data, x, meanlog and sdlog parameters.
liklnorm(meanlog = 0, sdlog = 1, x, log = FALSE)liklnorm(meanlog = 0, sdlog = 1, x, log = FALSE)
meanlog |
mean and standard deviation of the distribution
on the log scale with default values of |
sdlog |
mean and standard deviation of the distribution
on the log scale with default values of |
x |
vector of quantiles. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the log normal density given the data where meanlog and sdlog can be held constant or if vector were given vector will be returned.
liklnorm(x = rlnorm(n = 2))liklnorm(x = rlnorm(n = 2))
The log likelihood of a logistic density with data, x, location and scale parameters.
liklogis(location = 0, scale = 1, x, log = FALSE)liklogis(location = 0, scale = 1, x, log = FALSE)
location |
location and scale parameters. |
scale |
location and scale parameters. |
x |
vector of quantiles. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the logistic density given the data where location and scale can be held constant or if vector were given vector will be returned.
liklogis(x = rlogis(n = 2))liklogis(x = rlogis(n = 2))
The log likelihood of a multinomial density with data, x, size and prob parameters.
likmultinom(size = NULL, prob, x, log = FALSE)likmultinom(size = NULL, prob, x, log = FALSE)
size |
integer, say |
prob |
numeric non-negative vector of length |
x |
vector of length |
log |
logical; if TRUE, log probabilities are computed. |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the multinomial density given the data where size and prob can be held constant or if vector were given vector will be returned.
likmultinom(x = rmultinom(n = 2, size = 3, prob = .4), size = 3, prob = .4)likmultinom(x = rmultinom(n = 2, size = 3, prob = .4), size = 3, prob = .4)
The log likelihood of a negative binomial density with data, x, size, prob and mu parameters.
liknbinom(size, prob, mu, x, log = FALSE)liknbinom(size, prob, mu, x, log = FALSE)
size |
target for number of successful trials, or dispersion parameter (the shape parameter of the gamma mixing distribution). Must be strictly positive, need not be integer. |
prob |
probability of success in each trial. |
mu |
alternative parametrization via mean: see ‘Details’. |
x |
vector of (non-negative integer) quantiles. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the negative binomial density given the data where size, prob, and mu can be held constant or if vector were given vector will be returned.
liknbinom(x = rnbinom(n = 2, size = 3, prob = .4), size = 3, prob = .4, mu = NULL)liknbinom(x = rnbinom(n = 2, size = 3, prob = .4), size = 3, prob = .4, mu = NULL)
The log likelihood of a normal density with data, x, mean and sd parameters.
liknorm(mean = 0, sd = 1, x, log = FALSE)liknorm(mean = 0, sd = 1, x, log = FALSE)
mean |
vector of means. |
sd |
vector of standard deviations. |
x |
vector of quantiles. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the normal density given the data where mean and sd can be held constant or if vector were given vector will be returned.
liknorm(x = rnorm(n = 2))liknorm(x = rnorm(n = 2))
The log likelihood of a Poisson density with data, x, lambda parameter.
likpois(lambda, x, log = FALSE)likpois(lambda, x, log = FALSE)
lambda |
vector of (non-negative) means. |
x |
vector of (non-negative integer) quantiles. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the Poisson density given the data where lambda can be held constant or if vector were given vector will be returned.
likpois(x = rpois(n = 2, lambda = 4), lambda = 4)likpois(x = rpois(n = 2, lambda = 4), lambda = 4)
The log likelihood of a Student's t density with data, x, df and ncp parameters.
likt(df, ncp, x, log = FALSE)likt(df, ncp, x, log = FALSE)
df |
degrees of freedom ( |
ncp |
non-centrality parameter |
x |
vector of quantiles. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the Student's t density given the data where df and ncp can be held constant or if vector were given vector will be returned.
likt(x = rt(n = 2, df = 4), df = 4)likt(x = rt(n = 2, df = 4), df = 4)
The log likelihood of a uniform density with data, x, min and max parameters.
likunif(min = 0, max = 1, x, log = FALSE)likunif(min = 0, max = 1, x, log = FALSE)
min |
lower and upper limits of the distribution. Must be finite. |
max |
lower and upper limits of the distribution. Must be finite. |
x |
vector of quantiles. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the uniform density given the data where min and max can be held constant or if vector were given vector will be returned.
likunif(x = runif(n = 2))likunif(x = runif(n = 2))
The log likelihood of a Weibull density with data, x, shape and scale parameters.
likweibull(shape, scale = 1, x, log = FALSE)likweibull(shape, scale = 1, x, log = FALSE)
shape |
shape and scale parameters, the latter defaulting to 1. |
scale |
shape and scale parameters, the latter defaulting to 1. |
x |
vector of quantiles. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the Weibull density given the data where shape and scale can be held constant or if vector were given vector will be returned.
likweibull(x = rweibull(n = 2, shape = 3), shape = 3)likweibull(x = rweibull(n = 2, shape = 3), shape = 3)
The log likelihood of a Wilcoxon rank sum density with data, x, m and n parameters.
likwilcox(m, n, x, log = FALSE)likwilcox(m, n, x, log = FALSE)
m |
numbers of observations in the first and second sample, respectively. Can be vectors of positive integers. |
n |
numbers of observations in the first and second sample, respectively. Can be vectors of positive integers. |
x |
vector of quantiles. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The log likelihood is the log of a function of parameters given the data.
A numeric scalar for the log likelihood of the Wilcoxon rank sum density given the data where m and n can be held constant or if vector were given vector will be returned.
likwilcox(x = rwilcox(nn = 2, m = 3, n = 4), m = 3, n = 4)likwilcox(x = rwilcox(nn = 2, m = 3, n = 4), m = 3, n = 4)