This text connection: http://blog.csdn.net/freewebsys/article/details/45830613 reprint Please specify the source!
1, About time series
Time series analysis is a statistical method of dynamic Data processing. Based on stochastic process theory and mathematical statistics, this method is used to study the statistical laws of random data sequences to solve practical problems.
About R Environment Building reference I wrote the article before:
http://blog.csdn.net/freewebsys/article/details/45825267
Reference: http://baike.baidu.com/view/479624.htm
At the same time, I bought a book. It feels like a paper book, and it can kill time on the subway.
Http://item.jd.com/10490828.html
2, install TSA
Need to install the TSA library. R language installation is still more troublesome, depends on what do not understand.
This is only to study the installation of the TSA library below the Mac.
Install Gfortan First
http://cran.r-project.org/bin/macosx/tools/
Download Install: http://cran.r-project.org/bin/macosx/tools/gfortran-4.2.3.pkg
Then install the TSA, but the TSA relies on 4 libraries, the 4 libraries rely on other libraries, R's library management is not very good, can not rely on the download. Must be installed manually.
Files that need to be downloaded under Mac.
Http://cran.r-project.org/web/packages/zoo/index.html
Http://cran.r-project.org/web/packages/quadprog/index.html
Http://cran.r-project.org/web/packages/nlme/index.html
Http://cran.r-project.org/web/packages/tseries/index.html
Http://cran.r-project.org/web/packages/locfit/index.html
Http://cran.r-project.org/web/packages/mgcv/index.html
Http://cran.r-project.org/web/packages/leaps/index.html
Http://cran.r-project.org/web/packages/TSA/index.html
The package is still relatively regular. The generic "packages/package name/index.html" URL address.
Http://cran.r-project.org/bin/macosx/contrib/3.2/zoo_1.7-12.tgz
Http://cran.r-project.org/bin/macosx/contrib/3.2/quadprog_1.5-5.tgz
Http://cran.r-project.org/bin/macosx/contrib/3.2/nlme_3.1-120.tgz
Http://cran.r-project.org/bin/macosx/contrib/3.2/tseries_0.10-34.tgz
Http://cran.r-project.org/bin/macosx/contrib/3.2/locfit_1.5-9.1.tgz
Http://cran.r-project.org/bin/macosx/contrib/3.2/mgcv_1.8-6.tgz
Http://cran.r-project.org/bin/macosx/contrib/3.2/leaps_2.9.tgz
Http://cran.r-project.org/bin/macosx/contrib/3.2/TSA_1.01.tgz
The package is also regular, the "MacOSX" modified to "Windows" can be downloaded.
Go to the R command line to install.
Install. Packages("~/leaps_2.9.tgz") Install. Packages("~/locfit_1.5-9.1.tgz") Install. Packages("~/mgcv_1.8-6.tgz") Install. Packages("~/nlme_3.1-120.tgz") Install. Packages("~/tseries_0.10-34.tgz") Install. Packages("~/quadprog_1.5-5.tgz") Install. Packages("~/zoo_1.7-12.tgz")# # #包安装是有顺序的, the previous one is dependent on the latter one. # # #加载lib包, execute commands or check through the interface. Library"Nlme"Lib. Loc="/library/frameworks/r.framework/versions/3.2/resources/library") Library ("MGCV"Lib. Loc="/library/frameworks/r.framework/versions/3.2/resources/library") Library ("Locfit"Lib. Loc="/library/frameworks/r.framework/versions/3.2/resources/library") Library ("Quadprog"Lib. Loc="/library/frameworks/r.framework/versions/3.2/resources/library") Library ("Zoo"Lib. Loc="/library/frameworks/r.framework/versions/3.2/resources/library") Library ("Tseries"Lib. Loc="/library/frameworks/r.framework/versions/3.2/resources/library") Library ("TSA"Lib. Loc="/library/frameworks/r.framework/versions/3.2/resources/library")
Once all the packages have been installed, you can install the TSA.
Load success will prompt: (normal waring hint, can run TSA)
‘TSA‘from‘package:stats‘: objectisfrom‘package:utils‘: tar
The above operation must be correct, otherwise it will be error:
There isNo PackageCalled' Zoo' Error: Package orNamespace load failed for ' Tseries' There isNo PackageCalled' Quadprog' Error: Package orNamespace load failed for ' Tseries' # #必须安装gfortranLibrary notLoaded:/Library/frameworks/r.framework/versions/3.2/resources/lib/libgfortran. 2. Dyliberror: Package ' Leaps' Required by' TSA' Could notbe found
The package for the appropriate operating system must be downloaded, otherwise it will not be recognized.
isnot available (forversion3.2.0)
3,hello World TSA
Los Angeles annual Precipitation Time series chart.
The TSA library is successfully installed to run.
library(TSA)data(larain)plot(larain,type=‘o‘)
Show Results:
4, summary
This text connection: http://blog.csdn.net/freewebsys/article/details/45830613 reprint Please specify the source!
The R language makes time series analysis very convenient and important analytical tools. Ability to graphically display data, simple and efficient. However, the installation of TSA is cumbersome, the installation package is not very friendly, can not automatically install dependencies. But analyzing data is really convenient and efficient.
Analyze useful information from seemingly unrelated data. is an important place in the application of mathematics and spends a lot of time studying in the future. This is the most useful value.
R (2) time series analysis and application of TSA installation (R language)