R (2) TSA installation (R language) and tsa for Time Series Analysis and Application

Source: Internet
Author: User

R (2) TSA installation (R language) and tsa for Time Series Analysis and Application

The original Article connection: http://blog.csdn.net/freewebsys/article/details/45830613 reproduced please indicate the source!

1. Time Series

Time series analysis is a statistical method for dynamic data processing. This method is based on the random process theory and mathematical statistics method to study the statistical rules followed by random data sequences for solving practical problems.

For more information about setting up the R environment, see my previous article:
Http://blog.csdn.net/freewebsys/article/details/45825267

Reference: http://baike.baidu.com/view/479624.htm
At the same time, I bought a book. I feel like I still have the feeling that I can pass the time on the subway.
Http://item.jd.com/10490828.html

2. Install TSA

Install the TSA library. The installation of the R language is still quite troublesome.
Only install the TSA library under Mac.
First install gfortan
Http://cran.r-project.org/bin/macosx/tools/
Download installation: http://cran.r-project.org/bin/macosx/tools/gfortran-4.2.3.pkg

Then install the TSA, but the TSA depends on four libraries. These four libraries depend on other libraries. The R library is not well managed and cannot be downloaded. Must be installed manually.
Files to be downloaded in 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 regular. A url such as packages/package name/index.html.

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. You can download the package by changing "macosx" to "windows.

Enter the R command line for installation.

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 ") ### package installation is sequential, the first is the latter dependency. ### Load the lib package, run the command, or select the check box on 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 ")

After all the packages are installed, you can install TSA.
If the load is successful, the following message is displayed: (a normal waring prompt is displayed. You can run the TSA command)

Attaching package: 'TSA'The following objects are masked from 'package:stats':    acf, arimaThe following object is masked from 'package:utils':    tar

The preceding operation must be correct; otherwise, an error will be reported:

There is no package called 'zoo' Error: package or namespace load failed for 'tseries' there is no package called 'quadprog' Error: package or namespace load failed for 'tseries' # You must install gfortranLibrary not loaded:/Library/Frameworks/R. framework/Versions/3.2/Resources/lib/libgfortran.2.dylibError: package 'leaps 'required by 'tsa 'could not be found

You must download the corresponding OS package. Otherwise, the package is not recognized.

is not available (for R version 3.2.0)
3, hello world TSA

The time sequence of the annual precipitation in Los Angeles.

The TSA library can be run only after the installation is successful.

library(TSA)data(larain)plot(larain,type='o')

Display result:

4. Summary

The original Article connection: http://blog.csdn.net/freewebsys/article/details/45830613 reproduced please indicate the source!

R language is a very convenient and important analysis tool for time series analysis. Graphical display of data is simple and efficient. However, the installation of TSA is cumbersome, and the installation package is not friendly, so you cannot install the dependencies automatically. However, data analysis is really convenient and efficient.

Analyze useful information from seemingly unrelated data. It is an important part of mathematics application and will spend a lot of time studying it in the future. This is the most useful value.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.