Last data update: 2014.03.03

R: FitARMA: Fit ARMA or ARIMA using fast MLE algorithm
FitARMA-packageR Documentation

FitARMA: Fit ARMA or ARIMA using fast MLE algorithm

Description

Fit ARMA/ARIMA time series model using fast algorithm. All MLE computations in R. Two estimation functions: 'FitARMA' and 'GetFitARMA' are provided. 'FitARMA' provides more options including an option for exact MLE estimation of the intercept term. 'GetFitARMA' is provided for bootstrapping and simulation experiments. S3 Methods 'print', 'summary', 'coef', 'residuals', 'fitted' provided. Fast exact Gaussian ARMA simultation using C.

Details

Package: FitARMA
Type: Package
Version: 1.4
Date: 2010-12-01
License: GLP 2.0 or greater
LazyLoad: yes

FitARMA is the main function.

Author(s)

A.I. McLeod

References

A. I. McLeod, Ying Zhang (2007). Faster ARMA maximum likelihood estimation, Computational Statistics & Data Analysis 52(4), URL http://dx.doi.org/10.1016/j.csda.2007.07.020

See Also

arima, AcfPlot

Examples

data(SeriesA)
#ARIMA(0,1,1) with exact estimation of mean of differenced series
ans<-FitARMA(SeriesA, order=c(0,1,1), MeanMLEQ=TRUE)
ans
coef(ans)
#ARIMA(0,1,1) with sample-mean estimation of mean of differenced series
ans<-FitARMA(SeriesA, order=c(0,1,1))
ans
coef(ans)
#ARIMA(0,1,1) with mean of differenced series set to zero
#as in 'arima'
ans<-FitARMA(SeriesA, order=c(0,1,1), demean=FALSE)
ans
coef(ans)
# illustrating methods
summary(ans)
resid(ans)
fitted(ans)
ans$racf
#Simulate and fit Gaussian ARMA
z<-SimulateGaussianARMA(0.9, 0.5, 200)
#GetFitARMA is faster than FitARMA.
#Use GetFitARMA for parametric bootstrap and simulation experiments
GetFitARMA(z, p=1, q=1)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(FitARMA)
Loading required package: FitAR
Loading required package: lattice
Loading required package: leaps
Loading required package: ltsa
Loading required package: bestglm
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/FitARMA/FitARMA-package.Rd_%03d_medium.png", width=480, height=480)
> ### Name: FitARMA-package
> ### Title: FitARMA: Fit ARMA or ARIMA using fast MLE algorithm
> ### Aliases: FitARMA-package
> ### Keywords: package ts
> 
> ### ** Examples
> 
> data(SeriesA)
> #ARIMA(0,1,1) with exact estimation of mean of differenced series
> ans<-FitARMA(SeriesA, order=c(0,1,1), MeanMLEQ=TRUE)
> ans
Chemical process concentrations
ARIMA(0,1,1)  With mean MLE.
length of series = 196 ,  number of parameters = 2
loglikelihood = 224.78 ,  aic = -445.6 ,  bic =  -439
> coef(ans)
                 MLE         sd    Z-ratio
theta(1) 0.704395636 0.05070054 13.8932569
mu       0.004044893 0.02261129  0.1788882
> #ARIMA(0,1,1) with sample-mean estimation of mean of differenced series
> ans<-FitARMA(SeriesA, order=c(0,1,1))
> ans
Chemical process concentrations
ARIMA(0,1,1)
length of series = 196 ,  number of parameters = 2
loglikelihood = 224.73 ,  aic = -445.5 ,  bic =  -438.9
> coef(ans)
                 MLE         sd     Z-ratio
theta(1) 0.703101044 0.05079214 13.84271366
mu       0.002040816 0.02261138  0.09025615
> #ARIMA(0,1,1) with mean of differenced series set to zero
> #as in 'arima'
> ans<-FitARMA(SeriesA, order=c(0,1,1), demean=FALSE)
> ans
Chemical process concentrations
ARIMA(0,1,1)
length of series = 196 ,  number of parameters = 1
loglikelihood = 224.6 ,  aic = -447.2 ,  bic =  -443.9
> coef(ans)
               MLE         sd  Z-ratio
theta(1) 0.6993876 0.05105304 13.69924
mu       0.0000000 0.02262843  0.00000
> # illustrating methods
> summary(ans)
Chemical process concentrations
ARIMA(0,1,1)
length of series = 196 ,  number of parameters = 1
loglikelihood = 224.6 ,  aic = -447.2 ,  bic =  -443.9
> resid(ans)
  [1] -0.211536023 -0.447945681 -0.513287675  0.641012942  0.248316532
  [6]  0.073669514  0.651523548  0.155667520  0.008871940 -0.293795075
 [11]  0.494523355  0.145863524  0.302015147  0.211225662 -0.252271381
 [16]  0.123564513 -0.013580507  0.190501962 -0.466765282 -0.026449871
 [21]  0.281501287  0.196878522  0.237694406  0.066240531  0.246327809
 [26] -0.027721374 -0.119387986 -0.383498483  0.531785899  0.071924488
 [31]  0.650303098 -0.145183025 -0.201539379 -0.140957753 -0.398591502
 [36]  0.221230675  0.254724683 -0.121851709  0.314780852  0.020153951
 [41] -0.085905536 -1.060086009  0.558590019 -0.109329746 -0.076462637
 [46] -0.253475256  0.122720579 -0.414170179  0.110334179  0.377168154
 [51] -0.436217419 -0.505087665 -0.253252414 -0.177122097  0.276123418
 [56] -0.206883208  0.655309948  0.058315593 -0.559216043  0.108886060
 [61] -0.123844824 -0.386616601  1.129610337 -0.009963764  0.093031378
 [66] -0.234935131 -0.264314275  0.215142399 -0.349530175  0.255542251
 [71]  0.278726632  0.494940778 -0.553841630 -0.287357056 -0.100969493
 [76] -0.170616015 -0.019325588 -0.413516684 -0.189205961 -0.032330348
 [81] -0.122609871 -0.385746212 -0.169785954 -0.218748184  0.047008505
 [86] -0.067125288  0.153054379 -0.192958750 -0.134948413 -0.294379230
 [91] -0.005889033 -0.104118595  0.027178672  0.619002105  0.332929087
 [96]  0.432847043  0.302729786 -0.188275159  0.068320655 -0.352215785
[101]  0.453661300 -0.482714047  0.262398089  0.183524677 -0.171645630
[106] -0.620046457 -0.033651171  0.276466038 -0.206640158 -0.044521898
[111] -0.031137407  0.378224944  0.364527680  0.254945404 -0.221694289
[116] -0.055051303 -0.538501468 -0.076621346  0.146414116  0.202399917
[121]  0.341555563 -0.061123130  0.157249377  0.309974489  0.316788041
[126]  0.121558243  0.185016070  0.029399820  0.020564540  0.314381916
[131] -0.380123887 -0.265856598 -0.185932756 -0.030042233 -0.521008957
[136] -0.164384068 -0.014967033 -0.110471718 -0.077263729 -0.154035613
[141] -0.207732682  0.354712480 -0.051921118 -0.036312282  0.174605771
[146]  0.622120167  0.135103030 -0.005509672 -0.203857663  0.257421734
[151]  0.180035912  0.325913630  0.027940403 -0.280461567 -0.296153030
[156] -0.007125921  0.395017125  0.076270270  0.053343854 -0.062691131
[161] -0.043844206 -0.030659021  0.278557986 -0.005179233 -0.303621214
[166] -0.212346264 -0.048514156 -0.333930535 -0.033546246  0.376537970
[171]  0.763345719  0.533873034  0.173380895  0.021261332 -0.485132200
[176] -0.439298487 -0.107242010  0.024998904  0.217484335  0.252105323
[181]  0.576316341 -0.496931285 -0.347547334 -0.243067687  0.030002973
[186]  0.120982502  0.184610821  0.129112701 -0.309698297  0.783401276
[191]  0.747901799 -0.076926948  0.146197919  0.002248556 -0.498424684
[196] -0.148590444
> fitted(ans)
Time Series:
Start = 2 
End = 197 
Frequency = 1 
  [1] -0.188463977  0.147945681  0.313287675  0.358987058 -0.448316532
  [6] -0.173669514 -0.051523548 -0.455667520 -0.108871940 -0.006204925
 [11]  0.205476645 -0.345863524 -0.102015147 -0.211225662 -0.147728619
 [16]  0.176435487 -0.086419493  0.009498038 -0.133234718  0.326449871
 [21]  0.018498713 -0.196878522 -0.137694406 -0.166240531 -0.046327809
 [26] -0.172278626  0.019387986  0.083498483  0.268214101 -0.371924488
 [31] -0.050303098 -0.454816975  0.101539379  0.140957753  0.098591502
 [36]  0.278769325 -0.154724683 -0.178148291  0.085219148 -0.220153951
 [41] -0.014094464  0.060086009  0.741409981 -0.390670254  0.076462637
 [46]  0.053475256  0.177279421 -0.085829821  0.289665821 -0.077168154
 [51] -0.263782581  0.305087665  0.353252414  0.177122097  0.123876582
 [56] -0.193116792  0.144690052 -0.458315593 -0.040783957  0.391113940
 [61] -0.076155176  0.086616601  0.270389663 -0.790036236  0.006968622
 [66] -0.065064869  0.164314275  0.184857601 -0.150469825  0.244457749
 [71] -0.178726632 -0.194940778 -0.346158370  0.387357056  0.200969493
 [76]  0.070616015  0.119325588  0.013516684  0.289205961  0.132330348
 [81]  0.022609871  0.085746212  0.269785954  0.118748184  0.152991495
 [86] -0.032874712  0.046945621 -0.107041250  0.134948413  0.094379230
 [91]  0.205889033  0.004118595  0.072821328 -0.019002105 -0.432929087
 [96] -0.232847043 -0.302729786 -0.211724841  0.131679345 -0.047784215
[101]  0.246338700 -0.317285953  0.337601911 -0.183524677 -0.128354370
[106]  0.120046457  0.433651171  0.023533962 -0.193359842  0.144521898
[111]  0.031137407  0.021775056 -0.264527680 -0.254945404 -0.178305711
[116]  0.155051303  0.038501468  0.376621346  0.053585884 -0.102399917
[121] -0.141555563 -0.238876870  0.042750623 -0.109974489 -0.216788041
[126] -0.221558243 -0.085016070 -0.129399820 -0.020564540 -0.014381916
[131] -0.219876113  0.265856598  0.185932756  0.130042233  0.021008957
[136]  0.364384068  0.114967033  0.010471718  0.077263729  0.054035613
[141]  0.107732682  0.145287520 -0.248078882  0.036312282  0.025394229
[146] -0.122120167 -0.435103030 -0.094490328  0.003857663  0.142578266
[151] -0.180035912 -0.125913630 -0.227940403 -0.019538433  0.196153030
[156]  0.207125921  0.004982875 -0.276270270 -0.053343854 -0.037308869
[161]  0.043844206  0.030659021  0.021442014 -0.194820767  0.003621214
[166]  0.212346264  0.148514156  0.033930535  0.233546246  0.023462030
[171] -0.263345719 -0.533873034 -0.373380895 -0.121261332 -0.014867800
[176]  0.339298487  0.307242010  0.075001096 -0.017484335 -0.152105323
[181] -0.176316341 -0.403068715  0.347547334  0.243067687  0.169997027
[186] -0.020982502 -0.084610821 -0.129112701 -0.090301703  0.216598724
[191] -0.547901799 -0.523073052  0.053802081 -0.102248556 -0.001575316
[196]  0.348590444
> ans$racf
 [1]  0.095098644  0.008520494 -0.106281474 -0.118572304 -0.123951275
 [6] -0.005595666  0.142151585  0.020797722  0.038537968 -0.006755215
[11] -0.103519831 -0.122364296 -0.037578427  0.064098882 -0.132316206
[16] -0.010260246  0.044528436  0.074766813 -0.038536388  0.077994974
[21] -0.095059287 -0.031457326 -0.060089631  0.035251503  0.041839751
[26]  0.052892448  0.122597597 -0.069311977  0.038636486 -0.106436235
> #Simulate and fit Gaussian ARMA
> z<-SimulateGaussianARMA(0.9, 0.5, 200)
> #GetFitARMA is faster than FitARMA.
> #Use GetFitARMA for parametric bootstrap and simulation experiments
> GetFitARMA(z, p=1, q=1)
$loglikelihood
[1] 11.38844

$phiHat
[1] 0.9263359

$thetaHat
[1] 0.5492872

$convergence
[1] 0

$algorithm
[1] "L-BFGS-B"

> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>