calculate_entropy_and_mi: Calculate Entropy and mututal information for each treatment...

Description Usage Arguments Value Examples

View source: R/entropy_util.R

Description

Given an MEA recording, this function computes entropy and mutual information measures for each treatment level.

Usage

1
calculate_entropy_and_mi(mea, treatments, mult_factor = 1.5, bin_size = 0.1)

Arguments

mea

The input mea spikelist object

treatments

The treatment levels that MI and entropy will be computed.

mult_factor

The multiplication factor relating to the inter quartile range used in the algorithm. It serves as a tuning parameter with a default value of 1.5.

bin_size

The bin size(in second) used to compute mutual information.

Value

A list object holding MI and Entropy for each treatment level.

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
library(meaRtools)

data(S)
S <- filter_nonactive_spikes(S,spikes_per_minute_min=1)

treatments <- c("treatX", "treatY")
## compute entropies and MI's  
ENT.MI <- calculate_entropy_and_mi(S, treatments, mult_factor=1.5, bin_size=0.1)
data_dists <- ENT.MI[["data_dists"]]
norm_mis_per_well <- ENT.MI[["norm_mis_per_well"]]

# test for difference in mean entropy between treatmentA, treatmentB
ent <- data_dists[["ENT"]]
ent.WT <- mean(ent[[treatments[1]]])
ent.MUT <- mean(ent[[treatments[2]]])
ent.res <- wilcox.test(ent[[treatments[1]]], ent[[treatments[2]]])
cat("entropy means (WT / MUT) :", ent.WT, "/", ent.MUT, "\n")
print(ent.res)

# test for diff in mutual info btwn treatmentA, treatmentB
mi <- data_dists[["MI"]]
mi.WT <- mean(mi[[treatments[1]]])
mi.MUT <- mean(mi[[treatments[2]]])
mi.res <- wilcox.test(mi[[treatments[1]]], mi[[treatments[2]]])
cat("mutual info means (WT / MUT) :", mi.WT, "/", mi.MUT, "\n") 
print(mi.res)

  plot(density(mi[[treatments[1]]]))
  lines(density(mi[[treatments[2]]]), col="red")

meaRtools documentation built on May 1, 2019, 7:32 p.m.