ARp: Autoregressive model of order _p_

Description Usage Arguments Examples

View source: R/ARp.R

Description

Generates time series from an Autoregressive model of order p.

Usage

1
ARp(margdist, margarg, acsvalue, actfpara, n, p = NULL, p0 = 0)

Arguments

margdist

target marginal distribution

margarg

list of marginal distribution arguments

acsvalue

target auto-correlation structure (from lag 0)

actfpara

auto-correlation structure transformation parameters

n

number of values

p

integer - model order (if NULL - limits maximum model order according to auto-correlation structure values)

p0

probability zero

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
library(CoSMoS)

## choose the marginal distribution as Pareto type II with corresponding parameters
dist <- 'paretoII'
distarg <- list(scale = 1, shape = .3)
p0 <- .5

## estimate rho 'x' and 'z' points using ACTI
pnts <- actpnts(margdist = dist, margarg = distarg, p0 = p0)

## fit ACTF
fit <- fitactf(pnts)

## define target auto-correlation structure and model order
order <- 1000
acsvalue <- acs(id = 'weibull', t = 0:order, scale = 10, shape = .75)

## limit ACS lag (recomended)
system.time(val <- ARp(margdist = dist,
                       margarg = distarg,
                       acsvalue = acsvalue,
                       actfpara = fit,
                       n = 5000,
                       p0 = p0))

## order w/o limit
system.time(val <- ARp(margdist = dist,
                       margarg = distarg,
                       acsvalue = acsvalue,
                       actfpara = fit,
                       n = 5000,
                       p = order,
                       p0 = p0))


## see the result
ggplot() +
  geom_col(aes(x = seq_along(val),
               y = val)) +
  labs(x = '',
       y = 'value') +
  theme_classic()

TycheLab/CoSMoS documentation built on June 6, 2021, 2:35 a.m.