我在datagridview中有数据,每月有销售数字。 我如何计算平均值和std dev 让我们说数据如下 item#| MTH1 | Mth2 | Mth3 | Mth4 001 | 500 | 0 | 450 | 300 002 | 0 | 150 | 150 | 500 目前我正在添加每个项目的月数并除以零之外的月数即 001 =(500+ 450 + 300)/ 3 = 416.6667 002 =(150 + 150 + 500)/ 3 = 266.6667 这是正确的吗? Std Dev计算的任何线索? 提前感谢 Anoop
Hi, I have data in a datagridview with sales figures per month. how would i calculate the average and std dev lets say data as below item # | Mth1| Mth2| Mth3|Mth4 001 | 500 | 0 | 450 | 300 002 | 0 | 150 | 150 | 500 currently i am adding the months figures per item and dividing by the number of months excluding the zero i.e. 001 = (500+450+300)/3 = 416.6667 002 = (150+150+500)/3 = 266.6667 is this correct? any clue on the Std Dev calculations? thanks in advance Anoop
推荐答案这是数学,而不是编程: www.google/search?q=Std+Dev+calculations [ ^ ]。 This is mathematics, not programming: www.google/search?q=Std+Dev+calculations[^].
您的平均计算可能不正确。零值通常也计算在内。所以你必须除以4而不是三。 只有当你想要平均只有那些已售出商品的月份时才这是正确的(假设这个是每月表格中的某种商品。) 您已经获得了有关标准偏差的提示。 对于这样的计算,你可以使用一个循环来总结值和方块。然后可以使用平方和来计算偏差。 Your average calculation is probably not correct. The zero values are usually counted too. So you must divide by four and not by three. It would be only correct if you want the average only for those months where items has been sold (assuming that this is some kind of sold items per months table). You already got tips about the standard deviation. For such calculations you can use a loop summing up the values and the squares. The sum of the squares can then be used to calculate the deviation.
平均值是正确的:值的总和/值的数量。 标准偏差更复杂: en.wikipedia/wiki/Standard_deviation [ ^ ]看一下示例,这很明显。 Average is correct: Sum of values / number of values. Std Dev is more complex: en.wikipedia/wiki/Standard_deviation[^] look at the examples, and it's pretty obvious.
更多推荐
计算平均值和标准差
发布评论