ptsr.sim {PTSR}R Documentation

Function to simulate a PTSR model

Description

Function to simulate a PTSR model

Usage

ptsr.sim(n = 1, burn = 0, xreg = NULL, xregar = TRUE, varphi = 1,
  alpha = 0, beta = NULL, phi = NULL, theta = NULL,
  seed = stats::runif(1, 1000, 10000), rdist = r.gamma, link1 = "log",
  link2 = "identity", g1 = NULL, g1.inv = NULL, g2 = NULL)

Arguments

n

a strictly positive integer. The sample size of yt (after burn-in). Default is 1.

burn

a non-negative integer. length of "burn-in" period. Default is 0.

xreg

optionally, a vector or matrix of external regressors. For simulation purposes, the length of xreg must be n+burn. Default is NULL.

xregar

logical, if FALSE, the regressors are not included in the AR component of the model. Default is TRUE.

varphi

non-negative parameter. Default is 1.

alpha

a numeric value corresponding to the intercept. Default is 0.

beta

optionally, a vector of coefficients corresponding to the regressors in xreg. Default is NULL.

phi

optionally, for the simulation function this must be a vector of size pp, corresponding to the autoregressive coefficients (including the ones that are zero), where pp is the AR order. Default is NULL.

theta

optionally, for the simulation function this must be a vector of size qq, corresponding to the moving average coefficients (including the ones that are zero), where qq is the MA order. Default is NULL. that g2(yt)=0g_2(y_t) = 0, for t<1t < 1.

seed

optionally, an integer which gives the value of the fixed seed to be used by the random number generator. If missing, a random integer is chosen uniformly from 1,000 to 10,000.

rdist

function, the random number generator to be used

link1

character indicating which link must be used for μt\mu_t. See ptsr.link for available links. Default is ‘log’.

link2

character indicating which link must be used for yty_t in the AR recursion. See ptsr.link for available links. Default is ‘identity’.

g1

optionally, a link function to be used for μt\mu_t. Default is NULL, so that it is calculated internally, using link1.

g1.inv

optionally, a the inverse link function to be used for ηt\eta_t. It must the the ivnerse of g1. Default is NULL, so that it is calculated internally, using link1.

g2

optionally, a link function to be used for yty_t. Default is NULL, so that it is calculated internally, using link2.

Details

The function ptsr.sim generates a random sample from a positive time series regression model, with a given distribution.

Value

Returns a list with the following components

Examples


#-------------------------------------------------------------------
# Generating a sample of a Gamma-ARMA(1,1) model with no regressors
#-------------------------------------------------------------------

simu = ptsr.sim(n = 300, burn = 50,
                varphi = 20, alpha = 0,
                phi = 0.35, theta = 0.2,
                seed = 1234, rdist = r.gamma,
                link1 = "log", link2 = "log")

names(simu)
plot.ts(simu$yt)
lines(simu$mut, col= "red")


[Package PTSR version 0.1.2 Index]