MM {MM} | R Documentation |
Various multiplicative multinomial probability utilities
Description
Various multiplicative multinomial probability utilities for different types of observation
Usage
MM(y,n=NULL,paras)
MM_allsamesum(y, n=NULL, paras)
MM_differsums(y, n=NULL, paras)
MM_allsamesum_A(y, paras)
MM_differsums_A(y, paras)
MM_single(yrow, paras, givelog=FALSE)
MM_support(paras, ss)
Arguments
y |
Observations: a matrix, each row is a single observation |
yrow |
A single observation corresponding to one row of
matrix |
n |
Integer vector with one element for each row of |
ss |
Sufficient statistics, as returned by |
givelog |
Boolean in |
paras |
Object of class |
Details
Consider non-negative integers \(y_1,\ldots,y_k\) with \(\sum y_i=y\). Then suppose the frequency function of the distribution \(Y_1,\ldots,Y_k\) is
\[C\cdot{y\choose y_1,\ldots,y_k} \prod_{i=1}^k p_i^{y_i} \prod_{1\leq i < j\leq k}{\theta_{ij}}^{y_iy_j} \]where \(p_i,\ldots,p_k\geq 0\), \(\sum p_i=1\) correspond to probabilities; and \(\theta_{ij} > 0\) for \(1\leq i < j\leq k\) are additional parameters.
Here \(C\) stands for a normalization constant:
\[C=C(p,\theta,Y)= \sum_{y_1 + \cdots + y_k=y} \prod_{i=1}^k p_i^{y_i} \prod_{1\leq i < j\leq k}{\theta_{ij}}^{y_iy_j} \]which is evaluated numerically. This is computationally expensive.
The usual case is to use function MM()
.
Function
MM()
returns the log of the probability of a matrix of rows of independent multinomial observations. It is a wrapper forMM_allsamesum()
andMM_differsums()
. Recall that optional argumentn
specifies the number of times that each row is observed. CallsNormC()
.Function
MM_allsamesum()
gives the log of the probability of observing a matrix where the rowsums are identical. CallsNormC()
.Function
MM_differsums()
gives the log of the probability of observing a matrix where the rowsums are not necessarily identical. Warning: This function takes a long time to run. CallsNormC()
, possibly many times.Functions
MM_allsamesum_A()
andMM_differsums_A()
are analogous to functionsMM_allsamesum()
andMM_differsums()
but interpret the matrixy
as having rows corresponding to observations; each row is observed once, as indata(pollen)
. Both callNormC()
.Function
MM_single()
gives a likelihood function for aparas
object with a single multinomial observation (that is, a single line of matrixy
). Does not callNormC()
.Function
MM_support()
gives the support (that is, the log-likelihood) of aparas
object; argumentss
is the sufficient statistic, as returned bysuffstats()
. Does not callNormC()
.Function
dMM()
[documented more fully atrMM.Rd
] gives the probability of a single multivariate observation (ie a single row of the matrix argumenty
). CallsNormC()
.
Author(s)
Robin K. S. Hankin
Examples
data(voting)
data(voting)
p <- Lindsey(voting, voting_tally)
MM(voting,voting_tally,p) #No other value of 'p' gives a bigger value