简体   繁体   English

趋势线的最佳拟合曲线

[英]Best fit curve for trend line

Problem Constraints 问题约束

  • Size of the data set, but not the data itself, is known. 数据集的大小,但不是数据本身,是已知的。
  • Data set grows by one data point at a time. 数据集一次增长一个数据点。
  • Trend line is graphed one data point at a time (using a spline/Bezier curve). 趋势线一次绘制一个数据点(使用样条曲线/贝塞尔曲线)。

Graphs 图表

The collage below shows data sets with reasonably accurate trend lines: 下面的拼贴显示了具有相当准确的趋势线的数据集:

在此输入图像描述

The graphs are: 图表是:

  • Upper-left. 左上。 By hour, with ~24 data points. 按小时计算,有~24个数据点。
  • Upper-right. 右上方。 By day for one year, with ~365 data points. 白天为一年,有~365个数据点。
  • Lower-left. 左下方。 By week for one year, with ~52 data points. 每周一周,有~52个数据点。
  • Lower-right. 右下。 By month for one year, with ~12 data points. 按月计算,约有12个数据点。

User Inputs 用户输入

The user can select: 用户可以选择:

  • the type of time series (hourly, daily, monthly, quarterly, annual); 时间序列的类型(每小时,每日,每月,每季度,每年); and
  • the start and end dates for the time series. 时间序列的开始和结束日期。

For example, the user could select a daily report for 30 days in June. 例如,用户可以在6月份选择30天的每日报告。

Trend Weight 趋势重量

To calculate the window size (ie, the number of data points to average when calculating the trend line), the following expression is used: 要计算窗口大小(即计算趋势线时要平均的数据点数),使用以下表达式:

data points / trend weight

Where data points is derived from user inputs and trend weight is 6.4 . data points来自用户输入, trend weight6.4 Even though a trend weight of 6.4 produces good fits, it is rather arbitrary, and might not be appropriate for different user inputs. 即使6.4的趋势权重产生良好的拟合,它也是相当随意的,并且可能不适合不同的用户输入。

Question

How should trend weight be calculated given the constraints of this problem? 考虑到这个问题的限制,如何计算trend weight

Based on the looks of the graphs I would say you have too many points for your 12 point graph (it is just a spline of the points given... which is visually pleasing, but actually does more harm than good when trying to understand the trend) and too few points for your 365 point graph. 根据图表的外观,我会说你的12点图表有太多的分数(它只是给出的点的样条......这在视觉上是令人愉悦的,但实际上当试图理解它时弊大于利趋势)和365点图表的点数太少。 Perhaps try doing something a little exponential like: 也许尝试做一些像指数一样的事情:

(Data points)^1.2/14.1

I do realize this is even more arbitrary than what you already have, but arbitrary isn't the worst thing in the world. 我确实意识到这比你已经拥有的更加武断,但任意并不是世界上最糟糕的事情。

(I got 14.1 by trying to keep the 52 point graph fixed, since that one looks nice, by taking (52^(1.2)/52)*6.4=14.1 . You using this technique you could try other powers besides 1.2 to see what you visually get. (我通过尝试保持52点图固定得到14.1,因为那个看起来不错,通过采取(52^(1.2)/52)*6.4=14.1 。你使用这种技术你可以尝试除了1.2以外的其他功能看看是什么你在视觉上得到。

Dan

I voted this up for the quality of your results and the clarity of your write-up. 我对结果的质量和写作的清晰度进行了投票。 I wish I could offer an answer that could improve on your already excellent work. 我希望我能提供一个可以改善你已经很出色的工作的答案。

I fear that it might be a matter of trial and error with the trend weight until you see an improved fit. 我担心这可能是趋势重量的试验和错误,直到你看到改善的适合度。

It could be that you could make this an input from users as well: allow them to fiddle with the value, given realistic constraints, until they get satisfactory values. 也许你可以将这个作为用户的输入:允许他们在给定实际约束的情况下调整值,直到他们获得满意的值。

I also wondered if the weight would be different for each graph, since the number of points in each is different. 我还想知道每个图表的权重是否不同,因为每个图表中的点数不同。 Are you trying to get a single weighting that works for all graphs? 您是否尝试获得适用于所有图表的单一权重?

Excellent work; 优秀作品; a nice question. 一个很好的问题。 Well done. 做得好。 I wish I was more helpful. 我希望我更有帮助。 Perhaps someone else will have more wisdom to impart than I do. 也许别人会比我更有智慧传授。

It might look like the trend lines are accurate in those 4 graphs but its really quite off. 在这4张图中,趋势线看起来可能是准确的,但它确实很不合适。 (This is best seen in the begging of the lower left one and the beginning of the upper right. I would think that you would want to use no less than half of your points when finding the trend line (though really you should use much more than half). I would suggest a Trend Weight of 2 at a maximum. Though really you ought to stick closer to the 1-1.5 range. Since it is arbitrary i would suggest you give your user an "accuracy of trend line" slider that they can use where the most accurate setting uses a trend weight of 1 and the least accurate uses a weight of #of data points +1 . This would use 0 points (amusing you always round down) and, i would assume, though your statistics software might be different, will generate a strait horizontal line. (这在左下角的乞讨和右上角的开始时最好看。我认为在找到趋势线时你会想要使用不少于一半的分数(尽管你应该使用更多的东西)我建议最大趋势权重为2。虽然你应该更接近1-1.5范围。因为它是任意的,我建议你给你的用户一个“趋势线精确度”滑块,他们可以使用最准确的设置使用1的趋势权重,最不准确的使用#of data points +1的权重。这将使用0点(有趣的是你总是向下舍入),我会假设,虽然你的统计数据软件可能会有所不同,会生成一条海峡水平线。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM