没有合适的资源?快使用搜索试试~ 我知道了~
首页R语言入门:时间序列分析实战指南
"《用R语言处理时间序列:英文版 A Little Book of R for Time Series》是一本面向初学者的简明指南,作者Avril Coghlan,来自英国剑桥的Wellcome Trust Sanger Institute的Parasite Genomics Group。该书专注于介绍如何利用R语言进行时间序列分析,适合那些希望掌握数据挖掘和时间序列分析技巧的读者。 第1章主要介绍了R语言的基础安装和配置。章节从R的概述开始,包括其简介、如何下载和安装R软件,以及R的基本运行环境和交互方式。此外,还提供了链接和进一步阅读的资源,以便于读者深入了解和扩展学习。 在第2章,作者详细讲解了如何在R中进行时间序列分析。这部分涵盖了关键步骤,如读取时间序列数据(如CSV或Excel文件)、基本的数据可视化(如绘制时间序列图),以及数据分解(如季节性和趋势的识别)。随后,作者介绍了指数平滑法用于时间序列预测,并深入探讨了ARIMA模型(自回归整合移动平均模型)的应用,这是时间序列分析中的经典方法。 每节末尾都提供了丰富的链接和进一步阅读资料,鼓励读者探索更深入的主题和相关研究。第2章的最后部分再次强调了联系信息和版权许可。 第3章和第4章则是对前两章内容的总结和致谢,而第5章则包含了全书的版权许可信息,确保读者了解并尊重作者的知识产权。 《A Little Book of R for Time Series》以其简洁易懂的方式,为R语言新手提供了一个实用的时间序列分析工具箱,无论是学术研究还是商业应用,都能找到相应的学习资源。通过阅读本书,读者不仅能掌握R语言的实践技能,还能对时间序列分析有更深入的理解。"
资源详情
资源推荐
A Little Book of R For Time Series, Release 0.2
Alternatively, you can use the name of the fourth element in the table (“John”) to find the value of that table
element:
> mytable[["John"]]
[1] 2
Functions in R usually require arguments, which are input variables (ie. objects) that are passed to them, which
they then carry out some operation on. For example, the log10() function is passed a number, and it then calculates
the log to the base 10 of that number:
> log10(100)
2
In R, you can get help about a particular function by using the help() function. For example, if you want help
about the log10() function, you can type:
> help("log10")
When you use the help() function, a box or webpage will pop up with information about the function that you
asked for help with.
If you are not sure of the name of a function, but think you know part of its name, you can search for the function
name using the help.search() and RSiteSearch() functions. The help.search() function searches to see if you
already have a function installed (from one of the R packages that you have installed) that may be related to some
topic you’re interested in. The RSiteSearch() function searches all R functions (including those in packages that
you haven’t yet installed) for functions related to the topic you are interested in.
For example, if you want to know if there is a function to calculate the standard deviation of a set of numbers, you
can search for the names of all installed functions containing the word “deviation” in their description by typing:
> help.search("deviation")
Help files with alias or concept or title matching
’deviation’ using fuzzy matching:
genefilter::rowSds
Row variance and standard deviation of
a numeric array
nlme::pooledSD Extract Pooled Standard Deviation
stats::mad Median Absolute Deviation
stats::sd Standard Deviation
vsn::meanSdPlot Plot row standard deviations versus row
Among the functions that were found, is the function sd() in the “stats” package (an R package that comes with
the standard R installation), which is used for calculating the standard deviation.
In the example above, the help.search() function found a relevant function (sd() here). However, if you did not
find what you were looking for with help.search(), you could then use the RSiteSearch() function to see if a search
of all functions described on the R website may find something relevant to the topic that you’re interested in:
> RSiteSearch("deviation")
The results of the RSiteSearch() function will be hits to descriptions of R functions, as well as to R mailing list
discussions of those functions.
We can perform computations with R using objects such as scalars and vectors. For example, to calculate the
average of the values in the vector myvector (ie. the average of 8, 6, 9, 10 and 5), we can use the mean() function:
> mean(myvector)
[1] 7.6
We have been using built-in R functions such as mean(), length(), print(), plot(), etc. We can also create our own
functions in R to do calculations that you want to carry out very often on different input data sets. For example,
we can create a function to calculate the value of 20 plus square of some input number:
1.5. A brief introduction to R 9
A Little Book of R For Time Series, Release 0.2
> myfunction <- function(x) { return(20 + (x
*
x)) }
This function will calculate the square of a number (x), and then add 20 to that value. The return() statement
returns the calculated value. Once you have typed in this function, the function is then available for use. For
example, we can use the function for different input numbers (eg. 10, 25):
> myfunction(10)
[1] 120
> myfunction(25)
[1] 645
To quit R, type:
> q()
1.6 Links and Further Reading
Some links are included here for further reading.
For a more in-depth introduction to R, a good online tutorial is available on the “Kickstarting R” website, cran.r-
project.org/doc/contrib/Lemon-kickstart.
There is another nice (slightly more in-depth) tutorial to R available on the “Introduction to R” website, cran.r-
project.org/doc/manuals/R-intro.html.
1.7 Acknowledgements
For very helpful comments and suggestions for improvements on the installation instructions, thank you very
much to Friedrich Leisch and Phil Spector.
1.8 Contact
I will be very grateful if you will send me (Avril Coghlan) corrections or suggestions for improvements to my
email address alc@sanger.ac.uk
1.9 License
The content in this book is licensed under a Creative Commons Attribution 3.0 License.
10 Chapter 1. How to install R
CHAPTER 2
Using R for Time Series Analysis
2.1 Time Series Analysis
This booklet itells you how to use the R statistical software to carry out some simple analyses that are common in
analysing time series data.
This booklet assumes that the reader has some basic knowledge of time series analysis, and the principal focus of
the booklet is not to explain time series analysis, but rather to explain how to carry out these analyses using R.
If you are new to time series analysis, and want to learn more about any of the concepts presented here, I would
highly recommend the Open University book “Time series” (product code M249/02), available from from the
Open University Shop.
In this booklet, I will be using time series data sets that have been kindly made available by Rob Hyndman in his
Time Series Data Library at http://robjhyndman.com/TSDL/.
There is a pdf version of this booklet available at https://media.readthedocs.org/pdf/a-little-book-of-r-for-time-
series/latest/a-little-book-of-r-for-time-series.pdf.
If you like this booklet, you may also like to check out my booklet on using R for biomedical statistics, http://a-
little-book-of-r-for-biomedical-statistics.readthedocs.org/, and my booklet on using R for multivariate analysis,
http://little-book-of-r-for-multivariate-analysis.readthedocs.org/.
2.2 Reading Time Series Data
The first thing that you will want to do to analyse your time series data will be to read it into R, and to plot the
time series. You can read data into R using the scan() function, which assumes that your data for successive time
points is in a simple text file with one column.
For example, the file http://robjhyndman.com/tsdldata/misc/kings.dat contains data on the age of death of succes-
sive kings of England, starting with William the Conqueror (original source: Hipel and Mcleod, 1994).
The data set looks like this:
Age of Death of Successive Kings of England
#starting with William the Conqueror
#Source: McNeill, "Interactive Data Analysis"
60
43
67
50
56
42
50
65
68
43
11
剩余74页未读,继续阅读
ashther
- 粉丝: 3
- 资源: 32
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 多模态联合稀疏表示在视频目标跟踪中的应用
- Kubernetes资源管控与Gardener开源软件实践解析
- MPI集群监控与负载平衡策略
- 自动化PHP安全漏洞检测:静态代码分析与数据流方法
- 青苔数据CEO程永:技术生态与阿里云开放创新
- 制造业转型: HyperX引领企业上云策略
- 赵维五分享:航空工业电子采购上云实战与运维策略
- 单片机控制的LED点阵显示屏设计及其实现
- 驻云科技李俊涛:AI驱动的云上服务新趋势与挑战
- 6LoWPAN物联网边界路由器:设计与实现
- 猩便利工程师仲小玉:Terraform云资源管理最佳实践与团队协作
- 类差分度改进的互信息特征选择提升文本分类性能
- VERITAS与阿里云合作的混合云转型与数据保护方案
- 云制造中的生产线仿真模型设计与虚拟化研究
- 汪洋在PostgresChina2018分享:高可用 PostgreSQL 工具与架构设计
- 2018 PostgresChina大会:阿里云时空引擎Ganos在PostgreSQL中的创新应用与多模型存储
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功