使用 R 中的 ts 分析每日/每周数据 [英] Analyzing Daily/Weekly data using ts in R

查看:109
本文介绍了使用 R 中的 ts 分析每日/每周数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用 ts 类来分析我拥有的一些时间序列数据.

我感觉ts 类不太适合分析每日或每周数据.我在网上或 Cowpertwait 和 Metcalfe 的R 时间序列介绍"中看到的几乎所有示例都使用月度或年度数据.

我想用ts来分析每周的数据,是不是不可取?

解决方案

主要问题是,大多数想要分析每日或每周数据的人想要做一些事情,例如使用每年 365 天或每年 52 周的频率但一年中的天数或周数不是 365 或 52 天,甚至不是常数.如果你在闰年中删除一天的日数据,例如,或者一年中的每周使用 7 天,但在每周数据的情况下有 8 或 9 天,那么你可以捏造它.各种方案都是可能的.

通读此主题以获取示例.>

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆