| loglik {hyper2} | R Documentation |
Returns a log-likelihood for a given hyper2 object at a specific point
loglik(p, H, log = TRUE) loglik_single(p,H,log=TRUE) like_single_list(p,Lsub) like_series(p,L,log=TRUE)
H |
An object of class |
p |
A probability point. See details |
log |
Boolean with default |
L,Lsub |
A list of |
Function loglik() is a straightforward likelihood function. It
can take a vector of length n=size(H) or size(H)-1; if
given the vector
\(p=\left(p_1,\ldots,p_{n-1}\right)\) it
appends the fillup value, and then returns returns the (log)
likelihood.
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().
Likelihood is defined up to an arbitrary multiplicative constant. Log-likelihood (also known as support) is defined up to an arbitrary additive constant.
Currently, function loglik() interprets elements of a
probability vector according to their position in the vector; if given
a named vector, the names are ignored. This might change in a future
release.
Empty brackets are interpreted consistently: that is, zero whatever the probability vector (although the print method is not perfect).
Robin K. S. Hankin
data(chess)
loglik(c(1/3,1/3),chess)
loglik(rp(14,icons),icons)
## Not run: # takes too long
like_series(masterchef_maxp,masterchef)
like_series(indep(equalp(masterchef)),masterchef)
## End(Not run)
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