[go: up one dir, main page]

File: Rcode-3-2.R

package info (click to toggle)
urca 1.3-3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,432 kB
  • sloc: fortran: 501; ansic: 15; makefile: 2
file content (22 lines) | stat: -rwxr-xr-x 695 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
library(fracdiff)
set.seed(123456)
# ARFIMA(0.4,0.4,0.0)
y1 <- fracdiff.sim(n=1000, ar=0.4, ma=0.0, d=0.4)
# ARIMA(0.4,0.0,0.0)
y2 <- arima.sim(model=list(ar=0.4), n=1000)
# Graphics
op <- par(no.readonly=TRUE)
layout(matrix(1:6, 3, 2, byrow=FALSE))
plot.ts(y1$series,
        main='Time series plot of long memory',
        ylab='')
acf(y1$series, lag.max=100,
    main='Autocorrelations of long memory')
spectrum(y1$series,
         main='Spectral density of long memory')
plot.ts(y2,
        main='Time series plot of short memory', ylab='')
acf(y2, lag.max=100,
    main='Autocorrelations of short memory')
spectrum(y2, main='Spectral density of short memory')
par(op)