开发者

Compute Relative Frequency in Mathematica

开发者 https://www.devze.com 2023-03-30 21:57 出处:网络
With : dalist = {{379, 219, 228, 401}, {387, 239, 230, 393}, {403, 238, 217, 429}, {377, 233, 225, 432}}

With :

dalist = {{379, 219, 228, 401}, {387, 239, 230, 393}, 
          {403, 238, 217, 429}, {377, 233, 225, 432}}

BarChart@dalist

Compute Relative Frequency in Mathematica

I would like to compute / Plot the relative frequency instead of absolute count for each Bin for each condition.

Where :

{379, 219, 228, 401}

are the 4 bins count for one condition. So :

{379, 219, 228, 401}[[1]]/Total@{379, 219, 228, 401}

Compute Relative Frequency in Mathematica

is the result I want to see of the first condition / fir开发者_JS百科st Bin, instead of the count itself.


belisarius beat me to it.

You might also want to explore BarChart[dalist, ChartLayout -> "Percentile"]

Compute Relative Frequency in Mathematica


Isn't it

BarChart[dalist/Total /@ dalist]

?

Compute Relative Frequency in Mathematica


All you have to do is this:

In[13]:= #/Total[#] & /@ dalist

Out[13]= {{379/1227, 73/409, 76/409, 401/1227}, {387/1249, 239/1249, 
  230/1249, 393/1249}, {31/99, 238/1287, 217/1287, 1/3}, {377/1267, 
  233/1267, 225/1267, 432/1267}}

and chart it instead

0

精彩评论

暂无评论...
验证码 换一张
取 消