Description Usage Arguments Details Value Examples
Function to simulate a PTSR model
1 2 3 4 |
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 |
xregar |
logical, if |
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 |
phi |
optionally, for the simulation function this must be a vector
of size p, corresponding to the autoregressive coefficients
(including the ones that are zero), where p is the AR order.
Default is |
theta |
optionally, for the simulation function this must be a vector
of size q, corresponding to the moving average coefficients
(including the ones that are zero), where q is the MA order.
Default is |
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. See |
link2 |
character indicating which link must be used for y_t in the AR recursion. See |
g1 |
optionally, a link function to be used for μ_t. Default is |
g1.inv |
optionally, a the inverse link function to be used for η_t. It must the the ivnerse of |
g2 |
optionally, a link function to be used for y_t. Default is |
The function ptsr.sim
generates a random sample from a positive time
series regression model, with a given distribution.
Returns a list with the following components
yt
: the simulated time series
mut
: the conditional mean
etat
: the linear predictor g(μ_t)
error
: the error term.
1 2 3 4 5 6 7 8 9 10 11 12 13 | #-------------------------------------------------------------------
# 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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.