0% found this document useful (0 votes)
41 views8 pages

Subset Model Library (Fitar) Data Ts - Plot (Data)

1. The document analyzes time series data on lynx populations and DVD sales data to identify the best autoregressive (AR) models. 2. Models with lags of 1, 2, 7, 10, 11 and lags of 1, 2, 5 were identified as the top 2 models for the lynx data based on BIC values. 3. For the DVD sales data, models with lags of 1, 5 and lags of 1, 2, 5 were identified as having the lowest BIC scores, suggesting they best fit the data.

Uploaded by

Fitri Ayu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views8 pages

Subset Model Library (Fitar) Data Ts - Plot (Data)

1. The document analyzes time series data on lynx populations and DVD sales data to identify the best autoregressive (AR) models. 2. Models with lags of 1, 2, 7, 10, 11 and lags of 1, 2, 5 were identified as the top 2 models for the lynx data based on BIC values. 3. For the DVD sales data, models with lags of 1, 5 and lags of 1, 2, 5 were identified as having the lowest BIC scores, suggesting they best fit the data.

Uploaded by

Fitri Ayu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

subset model

> library(FitAR)
> data <- log(lynx)
> ts.plot(data)

>
acf(data)

pacf(data)

> SelectModel(data, lag.max = 15 , ARModel = "ARz", Best = 1)


[1]

7 10 11

> SelectModel(data, lag.max = 15 , ARModel = "ARz", Best = 2)


[[1]]
[[1]]$p
[1]

7 10 11

[[1]]$BICq
[1] -122.0932

[[2]]
[[2]]$p
[1]

[[2]]$BICq

7 10 11

[1] -119.2404

attr(,"model")

[1] "ARz"
attr(,"class")
[1] "Selectmodel"
> fit1 <- FitAR(data,15)
> coef(fit1)
MLE

sd

Z-ratio

phi(1)

1.12226595 0.09360281 11.9896609

phi(2)

-0.49773482 0.14065885 -3.5385959

phi(3)
phi(4)
phi(5)
phi(6)
phi(7)
phi(8)

0.27645968 0.14816898

1.8658405

-0.33151711 0.14951339 -2.2173071


0.16618504 0.15176434

1.0950204

-0.16055216 0.15204713 -1.0559368


0.08080211 0.15186681

0.5320590

-0.07250430 0.15190355 -0.4773049

phi(9)

0.17895375 0.15186681

1.1783598

phi(10)

0.13350277 0.15204713

0.8780354

phi(11) -0.18053660 0.15176434 -1.1895851


phi(12) -0.17551687 0.14951339 -1.1739207
phi(13)

0.02141282 0.14816898

0.1445162

phi(14)

0.05301346 0.14065885

0.3768939

phi(15) -0.03450496 0.09360281 -0.3686317


mu

6.68593287 0.09559781 69.9381415

> fit2 <- FitAR(data,c(1,2,7,10,11))


> fit2
AR(11). MLE.

Mean estimated using the sample mean

length of series = 114 ,


loglikelihood = 86.45 ,

number of parameters = 6
AIC = -160.9 ,

BIC =

-144.5 , UBIC =

-132.2

> coef(fit2)
MLE

sd

Z-ratio

zeta(1)

0.8256963 0.02044645 40.383358

zeta(2)

-0.6199471 0.08460334 -7.327691

zeta(7)

0.2459468 0.10422605

2.359744

zeta(10) -0.3468478 0.08559874 -4.052020


zeta(11) -0.3510605 0.08769747 -4.003085
mu

6.6859329 0.10986927 60.853531

> fit3 <- FitAR(data,c(1,2,4,7,10,11))


> fit3
AR(11). MLE.

Mean estimated using the sample mean

length of series = 114 ,


loglikelihood = 88.49 ,

number of parameters = 7
AIC = -163 ,

BIC =

> coef(fit3)
MLE

sd

Z-ratio

zeta(1)

0.8075909 0.01829638 44.139385

zeta(2)

-0.6310704 0.08609122 -7.330252

zeta(4)

-0.1410423 0.06257943 -2.253812

zeta(7)

0.2270251 0.09884352

2.296813

zeta(10) -0.3067903 0.08928585 -3.436046


zeta(11) -0.3413671 0.08803252 -3.877739
mu

6.6859329 0.08635576 77.423122

data dvd
> dvd <- read.table("G:/dvd.txt")
> data <- as.vector(dvd)
> data1 <- diff(data$V1)
> ts.plot(data1)

-143.8 , UBIC =

-132.2

5
0
-5

data

50

100

150

Time

> acf(data1)

0.4
0.2
0.0
-0.2

ACF

0.6

0.8

1.0

V1

10

15
Lag

20

> pacf(data1)

0.1
-0.2

-0.1

0.0

Partial ACF

0.2

0.3

0.4

Series data

10

15

20

Lag

> SelectModel(data1, lag.max = 15 , ARModel = "ARz", Best = 2)


[[1]]
[[1]]$p
[1] 1 5

[[1]]$BICq
[1] 312.9971

[[2]]
[[2]]$p
[1] 1 2 5

[[2]]$BICq

[1] 313.5502

attr(,"model")
[1] "ARz"
attr(,"class")
[1] "Selectmodel"
> fit1 <- FitAR(data1,15)
> coef(fit1)
MLE
phi(1)
phi(2)
phi(3)

sd

Z-ratio

0.5575200646 0.07904510

7.053189836

-0.3091161728 0.09029266 -3.423491840


0.1530974232 0.09335727

1.639909024

phi(4)

-0.0315556072 0.09408506 -0.335394458

phi(5)

-0.1472673701 0.09411812 -1.564707901

phi(6)

-0.2607074805 0.09468184 -2.753511019

phi(7)
phi(8)
phi(9)

0.2342656634 0.09681437

2.419740632

-0.1973288858 0.09732758 -2.027471410


0.0512726229 0.09681437

0.529597240

phi(10) -0.0682569247 0.09468184 -0.720908330


phi(11) -0.0003382397 0.09411812 -0.003593779
phi(12)

0.0401467833 0.09408506

0.426707322

phi(13)

0.0741778757 0.09335727

0.794559211

phi(14) -0.0780176429 0.09029266 -0.864053024


phi(15) -0.0173106561 0.07904510 -0.218997219
mu

0.2275000000 0.17529689

> summary(fit1)
AR(15). MLE.

1.297798284

length of series = 160 ,


loglikelihood = -129.427 ,

number of parameters = 16

series mean = 0.2275,

aic = 290.9 ,

bic =

rmse = 2.21606044209766,

340.1
R^2 = 38.353%

> fit2 <- FitAR(data1,c(1,5))


> coef(fit2)
MLE
zeta(1)

sd

Z-ratio

0.4281810 0.06291360

6.8058586

zeta(5) -0.3229736 0.07482012 -4.3166677


mu

0.2275000 0.25040469

0.9085293

> summary(fit2)
AR(5). MLE.
length of series = 160 ,
loglikelihood = -140.987 ,

number of parameters = 3

series mean = 0.2275,

aic = 288 ,

bic =

rmse = 2.39613996148327,

297.2 , UBIC =

301.8

R^2 = 27.927%

> fit3 <- FitAR(data1,c(1,2,5))


> coef(fit3)
MLE
zeta(1)

sd

Z-ratio

0.4258289 0.05598077

7.606700

zeta(2) -0.1664367 0.06352708 -2.619933


zeta(5) -0.3018746 0.07536875 -4.005302
mu

0.2275000 0.21306844

1.067732

> summary(fit3)
AR(5). MLE.
length of series = 160 ,
loglikelihood = -137.627 ,

number of parameters = 4

series mean = 0.2275,

aic = 283.3 ,

bic =

rmse = 2.34990732231365,

295.6 , UBIC =
R^2 = 30.681%

298.8

You might also like