在 R 中使用 ts 分析每日/每周数据 [英] Analyzing Daily/Weekly data using ts in R
问题描述
我刚刚开始使用 ts
类来分析我拥有的一些时间序列数据.
我感觉 ts
类不太适合分析每日或每周数据.我在网上或 Cowpertwait 和 Metcalfe 的R 的介绍性时间序列"中看到的几乎所有示例都使用月度或年度数据.
我想用ts
分析周数据,不建议吗?
主要问题是大多数想要分析每日或每周数据的人想做一些事情,比如使用每年 365 天或每年 52 周的频率但一年中的天数或周数不是 365 或 52,甚至不是常数.如果您在每日数据的情况下在闰年中减少一天,或者在一年中的每个星期使用 7 天,但在每周数据的情况下有 8 或 9 天除外,那么您可以捏造它.各种各样的方案都是可能的.
通读此线程以获取示例.p>
I have just started playing with the ts
class to analyze some time series data I have.
I am getting a sense that the ts
class is not well suited for analyzing daily or weekly data. Almost all the examples I see on the web or in Cowpertwait and Metcalfe's "Introductory Time Series with R" use monthly or annual data.
I would like to use ts
to analyze weekly data, is it not advisable ?
The main problem is that most people who want to analyse daily or weekly data want to do something like use a frequency of 365 days per year or 52 weeks per year but the number of days or weeks in a year is not 365 or 52 or even constant. If you drop one day in leap years in the case of daily data, say, or use 7 days for each week of the year except one which has 8 or 9 days in the case of weekly data, say, then you can fudge it. An endless variety of schemes is possible.
Read through this thread for an example.
这篇关于在 R 中使用 ts 分析每日/每周数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!