dsy48837 2014-04-17 10:02
浏览 48
已采纳

数学统计,如何计算预设

Imagine I have a table like this :

month-year varchar
nbr integer

values :

[01-2014,5],[02-2014,110],[03-2014,154],[04-2014,110]

Imagine we are the 15th of april. This datas are displayed on a linear graph. If I display the real value for the month of april the line will be down. What I would like is to display the trend rather than the real value for the current month.

I tought about doing something like this :

(5+110+154+110) / (3 + (15/30.5)) = 108

Where "3" is the number of month passed, "30.5" is the average number of days by month, and "15" is the number of days passed for the current month. This is wrong because it's lower than the real value.

I'm pretty sure there is a more formal way to do this, but as you can see I don't know a lot about statistics and trends. I tought about other ways but they are not very convincing.

Can you help me ?

NB: in reality I can get the count number by day, even by hours or minutes. I just count in mysql the number of entries and I have a date-time column. I described the table with month and year in order to make myself clear for the purpose of this example.

  • 写回答

1条回答 默认 最新

  • donte1234567 2014-04-17 10:11
    关注

    What you are trying to calculate is called a moving average.

    You have a slight bug in your calculation. The formula should be:

    (5+110+154+110) / (3 + (15/30.5))
                            ^^^^^^^
    

    You need to decide how many months back to include in your moving average.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料