Individuazione del modello

Processo AR 

Si proceda per tentativi per l’individuazione del modello che meglio approssima i dati.

  •  Simulazione di in modello AR(1) di 170 osservazioni fissando il parametro phi=0.6

> ar1<-arima.sim(n=170,list(order=c(1,1,0),ar=0.6))
> ar1
Time Series:
Start = 1
End = 171
Frequency = 1
  [1]  0.0000000 -0.7375444 -1.0355689 -2.4777613 -3.2032724 -2.2948103
  [7] -1.4941182  0.1368093  1.3850390  1.6277919  4.3641105  6.8016733
[13]  8.2328860  9.0499250 10.7308301 12.2702634 14.9032258 16.4995706
[19] 19.4134018 19.8904482 21.8807648 24.6778776 24.9983011 24.6157512
[25] 24.9478638 24.1727737 23.2579988 23.0778887 23.4324396 25.4085608
[31] 27.5649249 30.6109207 33.8436144 35.9743635 37.0941200 38.1313182
[37] 39.3090742 38.3976588 37.9543105 37.9500902 37.1770428 34.8367185
[43] 33.2934830 33.1244562 33.8171131 33.1678666 32.1401018 31.6099869
[49] 32.1591811 32.1303764 32.1486393 32.0200748 31.8405200 30.7802915
[55] 30.1212859 30.2690738 29.9777318 29.7323914 28.1452512 26.7055688
[61] 25.2828056 24.2621105 23.5874187 23.9320366 23.5284242 23.3078160
[67] 22.5596057 23.9519282 25.4960161 25.8549445 26.4484951 27.4126224
[73] 27.4243587 28.5075360 30.4841291 32.4843120 33.6289029 35.4467279
[79] 37.1227387 37.9812208 39.4522379 40.0379323 41.4059387 43.0711273
[85] 43.1771526 42.6844963 42.2212529 42.6927428 43.2140957 44.6267419
[91] 46.4059593 45.5815914 47.7594108 49.5538808 51.3366225 53.2515319
[97] 54.0200389 54.3239880 52.1873142 49.4323891 48.2891544 46.7765355
[103] 46.2690071 47.8717656 49.1076176 50.0322755 49.8788161 49.0825702
[109] 48.5961916 47.0287084 46.7841064 43.7322763 42.0717208 39.1940967
[115] 38.6412168 39.2892602 39.0265183 40.1082926 41.2851121 41.9517134
[121] 42.3389658 42.6226749 41.2378144 41.7813225 43.8046498 45.1969681
[127] 46.3753271 46.3818114 45.7429408 44.8397104 45.7706242 45.8623730
[133] 46.6183370 46.0031969 45.7647150 44.9246292 44.4294642 44.4562933
[139] 44.1665859 44.3390046 44.0077456 44.9850511 45.5315941 45.4270736
[145] 45.5421237 46.4077095 46.0270904 44.6091774 44.1203040 43.9732206
[151] 43.4359909 42.4899423 40.6917906 39.8144287 40.0876248 42.2593350
[157] 43.3158349 45.2563954 46.4372344 48.8340793 49.8591207 50.4734704
[163] 51.2639939 52.8132332 51.3220445 50.1243572 49.7937006 50.0489639
[169] 48.3752694 46.4184937 45.4417512

> plot(ar1,main="SIMULAZIONE DI UN PROCESSO AR(1)",col="blue")

 

  • Simulazione di un modello AR(1) di 170 osservazioni con parametro phi=0,15 e varianza 2,5:

> ar11<-arima.sim(n=170,list(ar=0.15,sd=sqrt(2.5)))
> ar11
Time Series:
Start = 1
End = 170
Frequency = 1
  [1] -1.4690336339 -0.0399395037  0.2998336591  1.2594775188
  0.1904448332
  [6]  1.0639445584  0.6947342595  0.7701135951  0.1826711094
  1.7597503216
[11] -0.9733798050 -1.2010013969 -0.1916544802  0.4634392155
  0.9031037004
[16]  2.4568212842 -0.6093219668  1.9675608364 -0.1324824978
-0.0732688324
[21]  0.9868222490  0.3652817330  0.8078136447 -1.7991087165
-0.4428696191
[26] -1.7447511838  0.4147847593 -1.4708191643  1.4685543918
-1.7646362786
[31] -0.3736421355  1.7725704051  0.7833342347  0.0006343414
  1.7357028453
[36]  0.7060314166 -0.4008795948 -1.1539233745  2.6666979960
-0.3564715486
[41]  0.2194268785  0.7804850920 -0.4620249576 -1.3175543274
  0.3021856521
[46]  0.3230394955  1.7472424366  1.0308000046  1.4012097760
  0.3416421527
[51]  0.4653618897  2.5764826993  1.6142970771 -0.5480520514
-1.1827095500
[56]  1.0949808309  0.5344900767 -0.3636353290  1.2727688493
-0.0068179214
[61]  1.3514429741 -0.7982123924  0.5779981685 -0.1145635273
  2.0335351457
[66] -0.1007232829  0.7895741837 -1.0775374813 -1.9429762364
-1.1080397179
[71] -0.9554619634  0.1772038499 -1.0474989050 -0.7183051153
-0.4335751750
[76] -0.9247199904 -0.4278831220 -0.1958545391  0.2425973929
-1.1089011185
[81] -0.0196799632  0.0547540556  0.5909806813 -0.5648335499
-1.6485220027
[86]  0.7893906276 -0.0493015621 -2.8409610477 -1.0042187144
-0.3527099945
[91] -1.6315823695 -0.2596377325 -0.9965897859 -1.5074801631
-2.8388178062
[96] -1.1259776472 -0.0155683575 -0.0797057545 -0.7469027961
-0.8571402741
[101]  0.9465972978  0.0171989364 -1.0831551621 -2.3095084329
-0.8882108521
[106] -0.2176889819  0.9407394329  1.1565404638  0.4013548307
  0.1679217379
[111] -1.9434344806 -1.6067222890  0.8237059669  1.0845215838
  1.5100616922
[116] -0.7890057819 -0.5797764945  0.4267545410  0.7049636954
-0.2774157598
[121]  0.9242622818  0.2016104080 -0.1172035949  0.4629335735
-0.7848993341
[126]  1.5859457213 -0.0687890336  0.6622152044 -0.4653405760
  1.4280674917
[131]  0.4910126175 -0.9890212262  1.0714418193 -0.7121885739
-1.4813067180
[136] -1.1075278776  0.1961005034  0.7412216432 -0.3724257757
  0.3305613563
[141]  1.1629642958  0.3776128142  0.2423366461 -1.4777760402
-0.2484361533
[146] -0.1669756235  1.2881987699 -0.2368699130  0.4625279491
-2.0167793174
[151] -0.6785451036  1.8835828853  0.3859228748 -0.4253082996
-0.0739179005
[156] -0.3845038762  0.6340635332  0.1953291053  0.1834966665
-0.1570903562
[161] -1.3834511461 -0.6669976388 -0.7769142032 -0.6939895778
-0.9903816740
[166]  0.6223976876  0.4962423529 -0.2174298546 -1.5667120756
-0.0209512910

> plot(ar11,main="SIMULAZIONE DI UN PROCESSO AR(1)",col="brown")
> abline(h=2.5)
> abline(h=-2.5)

Il modello ar11 sembra bene adattarsi alla serie, tuttavia si tenta anche l’implementazione di un modello AR di ordine superiore al primo.

  •  Simulazione di in modello AR(2) di 100 osservazioni con parametri phi1=0,5 e phi2=0,4

> ar2<-arima.sim(n=170,list(order=c(2,1,0),ar=c(0.5,0.4)))
> ar2
Time Series:
Start = 1
End = 171
Frequency = 1
  [1]   0.0000000   0.7416458   0.3408995   1.5255966   2.4866915 
3.6166142
  [7]   2.8964864   1.9531290   1.2535401  -0.8942762  -1.3884878
  -2.4389653
[13]  -4.2267933  -2.8160017  -2.5025175  -1.5966160  -3.9347968
  -4.2038814
[19]  -6.7303460  -8.1565659  -8.4282293  -9.2834039  -7.9099521
  -7.5129642
[25]  -6.5902404  -6.9066107  -5.7924841  -5.5600443  -6.3409236
  -5.9363999
[31]  -6.7870383  -9.0245331 -11.1512455 -12.4515057 -13.9602165
-15.5019754
[37] -18.2546020 -19.9257488 -22.0674941 -24.4675801 -27.2571622
-29.6364010
[43] -33.2228625 -36.7070816 -40.8920534 -44.0812366 -47.0841146
-51.5749387
[49] -54.5143933 -56.7928253 -58.2786986 -58.5026433 -59.2639845
-57.6444203
[55] -55.9213076 -53.9666046 -52.7702893 -53.3758109 -51.8470716
-50.7052869
[61] -48.7620241 -47.7043315 -47.1821508 -47.6432204 -47.3701677
-48.1909230
[67] -49.9738153 -51.5065356 -52.0038625 -54.4409229 -55.3404225
-54.8830192
[73] -53.4031546 -52.5725307 -51.2958713 -50.5414842 -48.6141725
-46.5231167
[79] -45.0802080 -44.9065231 -45.1604485 -43.6586001 -42.4579558
-40.5537259
[85] -39.2451215 -36.5794929 -34.6886051 -32.6218435 -29.3548277
-26.8210874
[91] -23.4517635 -20.9925591 -17.8160170 -14.8897997 -12.0038517
-10.6299223
[97]  -8.0423293  -5.8811788  -3.9416850  -2.0744492  -1.9024769
  -0.4065754
[103]   0.2941647  -1.0306816  -0.1901607  -0.1969264   0.7379729 
2.3615291
[109]   1.1770707   2.1314974   3.9981788   6.5822079   7.0730939
  10.0228340
[115]  10.1093402  11.3804773   9.9022800   8.2023428   6.6197507 
6.7794372
[121]   5.8105842   6.0151686   6.5614464   7.3748200   8.1897428 
7.2777576
[127]   8.1026103   8.5314157   8.7264903   8.2040121   6.4173916 
4.9390432
[133]   3.9165203   2.5899927   2.4310707   1.8668086   1.9251183 
3.2735172
[139]   3.6952221   4.9531544   4.7516738   6.0924070   7.0936590 
8.0631714
[145]   7.3917729   6.2365062   5.7605649   3.4207370   1.8813469
  -0.9456497
[151]  -4.1839871  -6.6217168  -9.8913829 -13.0697841 -15.7380008
-18.2078140
[157] -21.2155178 -24.4036006 -26.8389525 -30.6880774 -33.7792946
-37.0253318
[163] -40.3574752 -43.6375021 -46.0753507 -48.0424241 -50.5798501
-52.3177688
[169] -53.7696224 -53.4816007 -53.7934251

> plot(ar2,main="SIMULAZIONE DI UN PROCESSO AR(2)")

  • Simulazione di in modello AR(2) di 170 osservazioni con parametri phi1=0,88 e phi2 = –0,49 e varianza 0,15:

> ar22<-arima.sim(n=170,list(ar=0.88,-0.49),sd=sqrt(0.15))
> ar22
Time Series:
Start = 1
End = 170
Frequency = 1
  [1] -0.964082056 -1.180453543 -1.015624773 -1.013722166 -0.661666691
  [6] -0.081283227 -0.263501226 -0.578210892 -0.723210881 -0.149671137
[11] -0.708030378 -0.657979077  0.246154370  1.171803934  1.058795999
[16]  1.080316342  1.426547869  1.326610476  0.820915839  0.088268315
[21]  0.077293721 -0.777979888 -1.251450707 -1.269327896 -0.952887575
[26] -1.198701600 -1.597272416 -1.194151138 -0.655575517  0.961026998
[31]  0.661587886  1.030530256  0.948983976  0.626951724  0.806586436
[36]  0.142302419  0.062779558  0.087133597 -0.564976087 -0.911341680
[41] -0.818683245  0.017327733  0.018787846 -0.008157721 -0.008874559
[46] -0.496787200 -0.830570116 -0.579240450 -0.619959592 -0.972678643
[51] -1.025915974 -0.547766278  0.447416637  0.954630066  0.760727393
[56]  1.025591399  0.886856437  0.019711354  0.316259694  0.075342631
[61]  0.548930794  0.918894012  1.126035291  1.374897711  1.797419208
[66]  1.194903784  0.865367572  0.523007728  0.865300788  0.119702341
[71] -0.194865199  0.198625090  0.038040353  0.180345284  0.350205061
[76]  0.258697287  0.101998130  0.137509044  0.871133580  0.720081558
[81]  1.173211283  1.076440877  0.925734339 -0.009027872 -0.093374467
[86] -0.242600797  0.102010438  0.240159758 -0.022964073  0.278776440
[91] -0.216898388 -0.888970862 -1.638354706 -0.957271575 -0.879533254
[96] -1.253929162 -0.817519384 -0.805693987 -0.113425826 -0.016256955
[101] -0.351257997 -0.326800000 -0.353918549 -0.420720032 -1.480320961
[106] -1.480968227 -1.136130864 -1.158153650 -0.526739981 -0.836083409
[111] -0.802566461 -0.284775013 -0.036024191 -0.182723308 -0.194359702
[116]  0.109151838  0.074321542  0.537275112  0.102677163  0.445787862
[121]  0.860511143  1.419628422  1.227569538  0.801330553 -0.222442338
[126]  0.192470694  0.289465044  0.127952137  0.099396279 -0.384897111
[131] -0.796878964  0.009275999  0.482795319  1.035156544  0.531234982
[136]  0.917589121  0.258871912  0.529330695  0.513471822  0.345772905
[141]  0.317033172  0.258317913 -0.368594758 -0.109077366 -0.134507556
[146] -0.481433641  0.199203218 -0.190775442 -0.342969155 -0.187695630
[151] -0.236342158  0.116273927 -0.003930588 -0.858844661 -0.857620380
[156] -0.831315624 -1.091812963 -0.453843713 -0.281395848  0.282293788
[161]  0.412911800  0.294513676  0.432096062  0.499506437  0.337337262
[166]  0.562179507  0.517949064  0.217866289  0.015743004  0.277508224

> plot(ar22,main="SIMULAZIONE DI UN PROCESSO AR(2)")
> abline(h=0.15)
> abline(h=-0.15)

 

Processo MA

  • Simulazione di in modello MA(1) di 170 osservazioni con parametro theta=-0,7

> ma1<-arima.sim(n=170,list(order=c(0,1,1),ma=-0.7))
> ma1
Time Series:
Start = 1
End = 171
Frequency = 1
  [1]  0.00000000 -0.14537086  1.41001634  0.30581352  0.45762145
  1.47130453
  [7]  1.13395496  1.22709055  1.66558899  0.73830575  0.83026869
  0.44228278
 [13] -0.02017238  0.62654233 -0.51275444 -2.00369661 -1.16496636
 -0.26063591
 [19] -0.43824753 -0.97884216 -0.73318258 -0.54660170  0.09312164
 -1.47335054
 [25] -0.37722986 -1.35428552 -0.29277995 -0.53551190 -0.68125825
  0.79404591
 [31]  0.49757692  0.07500706 -0.31185477 -0.17634488 -0.61620559
  0.67859303
 [37]  0.51787649 -0.10001863 -0.32427306  1.12555164  0.80363636
  1.53676514
 [43]  0.77973908 -0.54330862 -0.98716267 -1.13386554 -1.48662789
 -1.52761709
 [49] -2.37229023 -0.80906902 -1.06510346  1.53887104  0.31189699
  0.49708015
 [55] -1.92002836  1.68350772  1.49330139  0.51873653 -0.11812353
  1.03284356
 [61] -0.11546888 -2.31227719 -3.16249789 -1.13884591 -1.82516761
 -2.11083163
 [67] -2.40910846 -3.21375919 -2.57729189 -1.28013568 -1.22331259
 -1.52700430
 [73] -0.64529645 -1.67102232  0.25920612 -0.65134642 -0.33858645
  0.81050832
 [79] -1.23940790 -0.97509553  1.03789187 -0.02563110 -0.87591974
 -1.90238138
 [85] -0.54331505  0.83173354  0.26578485  1.18406185 -0.63909376
 -1.24665254
 [91] -1.31467793  1.13527815  0.64509378  0.81633600  1.84856869
  0.97748616
 [97]  1.75803986  0.29104837 -0.43134955  0.24004645  0.55232638
 -1.31512735
[103] -3.07909811 -1.91233483 -0.61834732 -1.12493358 -1.03155155
 -0.33040522
[109] -0.59254922  0.08903392 -1.79445949  0.22735775 -0.36632314
 -0.83283235
[115] -0.54003661  0.11281521  0.30926505 -0.98179449 -0.28850550
 -0.20986720
[121] -1.02922818  0.12217547 -0.21905254  0.41799567 -1.14883208
 -0.55756252
[127] -0.59355013  0.47652730 -0.79747280 -0.56551155 -0.85614171
 -0.43184318
[133]  0.54386500  1.65162323  1.41972075  0.12959225  0.41476582
  1.21531679
[139]  1.29329107  1.72070785  0.57374928  0.85851370  0.68322633
 -0.95400487
[145] -0.23602644  0.46336938  0.29425772 -0.30474161  0.48087832
  0.49384372
[151] -0.63588359  0.45696279 -0.30923628  1.28298185  0.02806556
 -0.19737218
[157]  1.09644359 -0.08703303 -0.66437011  2.47805107  0.72490842
  0.48694640
[163]  1.85869255  1.97578221  2.03270994  2.82619735  2.82285238
  1.62191478
[169]  1.15720103  1.80676993  1.06868728

> plot(ma1,main="SIMULAZIONE DI UN PROCESSO MA(1)",col="yellow")

 

Processo ARIMA

  • Simulazione di un processo ARIMA(1,1,1) con parametri AR=0,05 e MA=0,3

> arima1<-arima.sim(n=170,list(order=c(1,1,1),ar=0.05,ma=0.3))
> plot(arima1,main="SIMULAZIONE DI UN PROCESSO ARIMA(1,1,1)",col="red")

 

 

 

 

Commenti

commenti