Skip to content
Back to formatted view

Raw Message

Message-ID: <3EBA7F55.40400@nac.spb.ru>
Date: 2003-05-08T16:01:25Z
From: Kosenkov Kirill
Subject: function to compute entropy

Maybe its slightly off-topic, but can anybody
help with computing entropy on matrix of probabilities?

Guess we have a matrix of probabilites, A, 2x2, something
like this:
    z
x   0     1     2     3     4
   0 0.063 0.018 0.019 0.016 0.000
   1 0.011 0.162 0.040 0.042 0.003
   2 0.015 0.030 0.164 0.033 0.002
   3 0.012 0.035 0.036 0.159 0.002
   4 0.004 0.021 0.018 0.013 0.082

sum(A)=1

Can i compute entropy like this:
entropy<-sum(A*log2(A)) ?

is there a function for computing entropy in R?

Thanx.