dmm: Calculate the probability of a permutation in a MM

View source: R/PerMallows.R

dmmR Documentation

Calculate the probability of a permutation in a MM

Description

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

Usage

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

Arguments

perm

permutation whose probability is asked for

sigma0

optional central permuation of the MM, by default the identity

theta

dispersion parameter of the MM

dist.name

optional name of the distance used in the MM. One of: kendall (default), cayley, hamming, ulam

Value

The probability of sigma in the given MM

Examples

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)
log.prob <- apply(data,MARGIN=1,FUN=function(x){log(dmm(x,sig, 1,"cayley"))})
sum(log.prob)
dmm(c(1,3,2,4), theta=0.1)
dmm(c(1,3,2,4), theta=0.1, dist.name="cayley")
dmm(c(1,3,2,4), theta=0.1, dist.name="hamming")
dmm(c(1,3,2,4), theta=0.1, dist.name="ulam")

PerMallows documentation built on April 3, 2025, 11:09 p.m.

Related to dmm in PerMallows...