Learn R Programming

PerMallows (version 1.13)

dgmm: Calculate the probability of a permutation in a GMM

Description

Calculate the probability of a permutation sigma in a GMM of center sigma0, dispersion parameter theta and under the specified distance

Usage

dgmm(perm, sigma0 = identity.permutation(length(perm)), theta,
  dist.name = "kendall")

Arguments

perm
permutation whose probability wants to be known
sigma0
central permuation of the GMM, by default the identity
theta
vector dispersion parameter of the GMM
dist.name
optional name of the distance used in the GMM. One of: kendall (default), cayley, hamming

Value

The probability of sigma in the given GMM

Examples

Run this code
data <- matrix(c(1,2,3,4, 1,4,3,2, 1,2,4,3), nrow = 3, ncol = 4, byrow = TRUE)
sig <- c(1,2,3,4)
th <- c(0.1, 0.2, 0.3,1)
log.prob <- apply(data,MARGIN=1,FUN=function(x){log(dgmm(x,sig, th, "hamming"))})
sum(log.prob)
dgmm (c(1,2,3,4), theta=c(1,1,1))
dgmm (c(1,2,3,4), theta=c(1,1,1), dist.name="cayley")

Run the code above in your browser using DataLab