coefs.start {BTSR}R Documentation

Initial values for coefficients

Description

Generates initial values for coefficients in BTSR models.

Usage

coefs.start(model, yt, y.start = NULL, y.lower = 0, y.upper = 1,
  xreg = NULL, p = 0, q = 0, d = FALSE, map = .default.map.barc,
  lags = NULL, fixed.values = NULL, fixed.lags = NULL,
  linkg = "linear", configs.linkg = NULL)

Arguments

model

character string (case-insensitive) indicating the model to be fitted to the data. Must be one of the options listed in the Section Supported Models.

yt

numeric vector with the observed time series. Missing values (NA's) are not allowed.

y.start

optional; an initial value for Y_t (to initialize recursions when t < 1). Default is y.start = NULL, in which case, the recursion assumes that Y_t = g_{12}^{-1}(0), for t < 1. Only relevant if p > 0.

y.lower

the lower limit for the Kumaraswamy density support. Default is y.lower = 0.

y.upper

the upper limit for the Kumaraswamy density support. Default is y.upper = 1.

xreg

optional; external regressors. Can be specified as a vector, a matrix or a list. Default is xreg = NULL. For details, see the Section Regressors format.

p

the AR order. Default is p = 0. Can be provided as either a single integer (legacy format) or a length 2 integer vector (new format) specifying orders for part1/part2. If \nu is time-varying and a single value is provided it is assumed that p_1 = p_2 = p.

q

the MA order. Default is q = 0. Can be provided as either a single integer (legacy format) or a length 2 integer vector (new format) specifying orders for part1/part2. If \nu is time-varying and a single value is provided it is assumed that q_1 = q_2 = q.

d

a length 1 (legacy format) or 2 (new format) logical vector indicating whether the long memory parameter d is presented in the model (either as a fixed or non-fixed parameter). In the new format, if only one value is provided the code assumes that the same option is valid for both parts of the model. Default is d = FALSE.

map

a non-negative integer from 1 to 5 corresponding to the map function. Default is map = 4. See the Section The map function.

lags

optional; specification of which lags to include in the model. For one dimensional coefficients, the lag is obviously always 1 and can be suppressed. Can be specified in one of two ways

  • a list with components beta, phi, and theta (legacy format) specifying which lags to include for each parameter type.

  • a list with elements part1 and part2 (new format), each being a list with components beta, phi, and theta specifying which lags to include for each parameter type.

Default is lags = NULL, in which the lags are computed from the fixed.lags argument (if provided). When components are missing or empty in both, lags and fixed.lags, the default behavior is to include all lags based on nreg = ncol(xreg), p, and q. The arguments lags and fixed.lags are complementary. Either suffices, or mix them (e.g., lags for some parameters, fixed.lags for others).

fixed.values

optional; specification of fixed parameter values. Can be specified in one of two ways

  • a list with optional components alpha, beta, phi, theta, d and nu (legacy format) containing fixed values for each parameter type.

  • a list with elements part1 and part2 (new format), each being a list with optional components alpha, beta, phi, theta and d containing fixed values for each parameter type.

If fixed values are provided and there exists more than one possible lag, either lags or fixed.lags must also be provided. The default is fixed.lags = NULL. By default, if a given vector (such as the vector of AR coefficients) has fixed values and the corresponding entry in this list is empty, the fixed values are set as zero.

fixed.lags

optional; specification of which lags should be fixed. For one dimensional coefficients, the lag is obviously always 1 and can be suppressed. Can be specified in one of two ways

  • a list with components beta, phi, and theta (legacy format) specifying which lags should be fixed.

  • a list with elements part1 and part2 (new format), each being a list with components beta, phi, and theta specifying which lags should be fixed.

For missing components, fixed values will are set based on lags.

linkg

specification of link functions. Can be specified in one of two ways

  • A character or two-character vector (legacy format). If only one string is provided, the same link name is used for \mu_t (g_{11}) and for Y_t (g_{12}).

  • A named list (new format) with elements g11, g12, g2, g21, and g22 (order does not matter). Particular models (see ‘Particular Models’ in BTSR.functions) have default values for some links. Missing links follow these rules

    • If either g11 or g12 is missing (but not both), assumes g12 = g11

    • If phi = NULL for part 1, g12 is not required

    • If phi = NULL for part 2, g22 is not required

    • If either g21 or g22 is missing (but not both), assumes g22 = g21

    Special case: g2 = "default" uses the model's default link. The default depends on the model.

Default is linkg = "linear", which is equivalent (done internally) to set all links as "linear" in the new format. See link.btsr for valid links. For details, see the Section ‘The BTSR structure’ in btsr-package.

configs.linkg

a list with two elements, ctt and power, which define the constant a and the exponent b in the link function g(x) = a x^b. Each element can be specified as a numeric value, a vector of size 2 or a named list. The default is configs.linkg = NULL. See the Section Link defaults for details.

Details

Parameter initialization is done as follows.

  1. Legacy flat lists are converted to nested part1/part2 format. Link functions and density bounds are validated.

  2. Part 1: \mu_t related parameters.

    A linear model is used to estimate \alpha, \boldsymbol \beta and \boldsymbol \phi by setting

    \boldsymbol{Y} = \begin{pmatrix} Y_1 \\ \vdots \\ Y_n \end{pmatrix} \quad \text{and} \quad D = \begin{pmatrix} 1 & X_{11} & \cdots & X_{1s} & g_{12}(Y_0) & \cdots & g_{12}(Y_{1-p}) \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\ 1 & X_{n1} & \cdots & X_{ns} & g_{12}(Y_{n-1}) & \cdots & g_{12}(Y_{n-p}) \end{pmatrix}

    where s is the number of regressors and p is the AR order, and solving the linear regression problem \boldsymbol{Y} = D\boldsymbol{\gamma} + \boldsymbol{\epsilon} via lm.fit.

    MA coefficients \boldsymbol{\theta} are initialized to zero (though small non-zero values may help with optimization stability)

    The long-memory parameter d starts at 0.01 when estimated

    For BARC models:

    • Map parameters use:

         +-------+-------+-------+-------+-------+-------+
         |  map  |   1   |   2   |   3   |   4   |   5   |
         +-------+-------+-------+-------+-------+-------+
         | theta |   3   |  0.5  |  3.5  |  0.5  |  NA   |
         +-------+-------+-------+-------+-------+-------+
      
    • u_0 defaults to \pi/4 when not fixed

  3. Part 2: \nu_t related parameters.

    If presented and not time varying, \nu is initialized as follows:

    • \nu = 5, for the Kumaraswamy and the Unit-Weibull distributions,

    • \nu = \displaystyle\frac{1}{n}\sum_{t=1}^n\dfrac{\hat \mu_t (1 - \hat \mu_t)}{\sigma^2} - 1, for the Beta distribution,

    • \nu = \displaystyle\frac{1}{n}\sum_{t=1}^n\frac{\hat \mu_t^2}{\sigma^2}, for the Gamma distribution

    where (\hat\mu_1, \cdots, \hat\mu_n)' = D\hat{\boldsymbol{\gamma}} are the fitted values from the regression model and \sigma^2 is the estimated variance of the residuals.

    If \nu is time varying,

    • set \alpha as g_{12}(g_2(\nu)), with \nu estimated as in the case where the parameter does not vary on time.

    • set \boldsymbol{\beta}, \boldsymbol{\phi} and \boldsymbol{\theta} to zero.

    • The long-memory parameter d starts at 0.01 when estimated.

Value

For models where \nu_t is not time-varying, returns a list (legacy format) with starting values for the parameters of the selected model. Possible outputs are

alpha

the intercept.

beta

the coefficients for the regressors.

phi

the AR coefficients.

theta

for BARC models, the parameter associate to the map function. For any other model, the MA coefficients.

d

the long memory parameter.

nu

distribution related parameter (usually, the precision).

u0

for BARC models, the initial value of the iterated map.

For models where \nu_t is time-varying, returns a list whose elements are part1 and part2. Each element is a list with starting values for the parameters corresponding to each part o the selected model. Possible outputs for each part are the same as for the legacy format.

Examples

mu <- 0.5
nu <- 20

yt <- rbeta(100, shape1 = mu * nu, shape2 = (1 - mu) * nu)
# using the general model BARFIMA
coefs.start(model = "BARFIMA", yt = yt, linkg = "linear")
# same output as the specific model BETA
coefs.start(model = "BETA", yt = yt, linkg = "linear")

yt <- rgamma(100, shape = nu, scale = mu / nu)
coefs.start(model = "GARFIMA", yt = yt, linkg = "linear")


[Package BTSR version 1.0.0 Index]