migen: Mutual Information - General

Description Author(s) Examples

Description

This package calcuates mutual information through either nearest k neighbor algorithm or kernel smoothing.

Author(s)

Paul Lin, Chris Pardy

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## normal indpendent data
  w2 <- c(1,1,1)
  probs <- w2 / sum(w2)
  w <- rowSums(rmultinom(100, 1, prob=probs))
  X<-rnorm(sum(w),0,1)
  Y<-c(rep("A",w[1]), rep("B",w[2]), rep("C",w[3]))

## Using k neighbor algorithm
  mmik(X,Y)
## Using kernel smoothing
  mmis(X,Y)
  
## US state data  
  x<-state.x77[,1]
  y<-state.x77[,2]
  plot(x,y)
  cor(x,y)
  cmik(x,y)
  cmis(x,y)
  
## US arrests data
  x<-USArrests[,1]
  y<-USArrests[,2]
  plot(x,y)
  cor(x,y)
  cmik(x,y)
  cmis(x,y)

## Spot Patterns
  x <-c(rnorm(50,-10,3), rnorm(50,0,3),rnorm(50,2,3))
  y <-c(rnorm(50,-5,3), rnorm(50,5,3),rnorm(50,-10,3)) 
  plot(x,y)
  cor(x,y)
  cmik(x,y)
  cmis(x,y)
    

paulyLin/migen documentation built on May 24, 2019, 10:34 p.m.