ptsr.fit | R Documentation |
Fit a PTSR model to a univariate time series.
ptsr.fit(start, yt, xreg = NULL, xregar = TRUE, fit.alpha = TRUE,
p = 0, q = 0, arlag = NULL, malag = NULL, ddist = d.gamma,
link1 = "log", link2 = "identity", g1 = NULL, g1.inv = NULL,
g2 = NULL, method = "L-BFGS-B", ...)
start |
a vector with the starting values for the non-fixed coefficients of the model. |
yt |
the time series |
xreg |
optionally, a vector or matrix of external regressors. Default is
|
xregar |
logical, if |
fit.alpha |
logical, if FALSE, alpha is set to zero. Default is
|
p |
order of the AR polinomial |
q |
order of the MA polinomial |
arlag |
the lags to be included in the AR polinomial. Default is
|
malag |
the lags to be included in the MA polinomial. Default is
|
ddist |
function, the density function to be used |
link1 |
character indicating which link must be used for |
link2 |
character indicating which link must be used for |
g1 |
optionally, a link function to be used for |
g1.inv |
optionally, a the inverse link function to be used for
|
g2 |
optionally, a link function to be used for |
method |
The method to be used. See [optim][stats::optim] for details. |
... |
Further arguments to be passed to |
The same arguments return by optim
plus the following arguments
coefficients
: a vector with the estimated coefficients;
sll
: the sum of the log-likelihood for the fitted model;
series
: the original time series;
xreg
: the regressors (if any);
fitted.values
: the conditional mean, which corresponds to
the in-sample forecast, also denoted fitted values;
residuals
: the observed minus the fitted values;
model
: a list with the configurations used to fit the model.
#-------------------------------------------------------------------
# Gamma-ARMA(1,1) model with no regressors
#-------------------------------------------------------------------
simu <- ptsr.sim(
n = 3000, burn = 50,
varphi = 20, alpha = 0,
phi = 0.35, theta = 0.2,
seed = 1234, rdist = r.gamma,
link1 = "log", link2 = "log"
)
fit1 <- ptsr.fit(
start = c(0, 0, 0, 10), yt = simu$yt,
fit.alpha = TRUE, p = 1, q = 1,
ddist = d.gamma, link1 = "log",
link2 = "log", method = "L-BFGS-B"
)
summary(fit1)
# removing alpha from the model
fit2 <- ptsr.fit(
start = c(0, 0, 10), yt = simu$yt,
fit.alpha = FALSE, p = 1, q = 1,
ddist = d.gamma, link1 = "log",
link2 = "log", method = "L-BFGS-B"
)
summary(fit2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.