Learn R Programming

hyper2 (version 2.0-0)

loglik: Log likelihood functions

Description

Returns a log-likelihood for a given hyper2 object at a specific point

Usage

loglik(p, H, log = TRUE)
loglik_single(p,H,log=TRUE)
like_single_list(p,Lsub)
like_series(p,L,log=TRUE)

Arguments

H

An object of class hyper2

p

A probability point. See details

log

Boolean with default TRUE meaning to return the log-likelihood and FALSE meaning to return the likelihood

L,Lsub

A list of hyper2 objects, or a list of list of loglik objects

Details

Function loglik() is a straightforward likelihood function. It takes the vector \(p=\left(p_1,\ldots,p_{n-1}\right)\) and returns the (log) likelihood. Note that the ‘fillup’ value is automatically appended; the elements of p are (linearly!) independent.

Function size() returns the (nominal) length \(n\) of nonnegative vector \(p=\left(p_1,\ldots,p_n\right)\) where \(p_1+\cdots+p_n=1\).

If p is a matrix, the rows are interpreted as probability points.

Function loglik_single() is a helper function that takes a single point in probability space.

Functions like_single_list() and like_series() are intended for use with ggrl().

See Also

maxp

Examples

Run this code
# NOT RUN {
data(chess)
loglik(c(1/3,1/3),chess)

data(masterchef)

a1 <- rep(1/13,12)                  # equal strengths
a2 <- indep(masterchef_maxp)        # MLE

like_series(a1,masterchef)
like_series(a2,masterchef)


W <- hyper2(pnames=letters[1:6])
W1 <- ggrl(W, 'a', letters[2:5],'f')              # 24-element list
W2 <- ggrl(W, c('a','b'), c('c','d'),c('e','f'))  # 2^3=8 element list

like_single_list(rep(1/6,5),W1)      # information from first observation
like_series(rep(1/6,5),list(W1,W2))  # information from both observations


# }

Run the code above in your browser using DataLab