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.
function to compute entropy
2 messages · Kosenkov Kirill, Spencer Graves
Have you considered: entropy<-sum(A*logb(A, 2)) hth. spencer graves
Kosenkov Kirill wrote:
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.
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help