ptsr.fit {PTSR}R Documentation

Title Function to fit a PTSR model

Description

Title Function to fit a PTSR model

Usage

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", ...)

Arguments

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 NULL

xregar

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

fit.alpha

logical, if FALSE, alpha is set to zero. Default is TRUE

p

order of the AR polinomial

q

order of the MA polinomial

arlag

the lags to be included in the AR polinomial. Default is NULL, meaning that all lags will be included.

malag

the lags to be included in the MA polinomial. Default is NULL, meaning that all lags will be included.

ddist

function, the density function to be used

link1

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

link2

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

g1

optionally, a link function to be used for \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 \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 y_t. Default is NULL, so that it is calculated internally, using link2.

method

The method to be used. See [optim][stats::optim] for details.

...

Further arguments to be passed to optim.

Value

The same arguments return by optim plus a the following arguments

Examples


#-------------------------------------------------------------------
# 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)


[Package PTSR version 0.1.2 Index]