smart_weightpars function

Create random transition weight parameter values

Create random transition weight parameter values

smart_weightpars generates random transition weight parameter values relatively close to the ones given in weight_pars

smart_weightpars( M, weight_pars, weight_function = c("relative_dens", "logistic", "mlogit", "exponential", "threshold", "exogenous"), weight_constraints = NULL, accuracy )

Arguments

  • M: a positive integer specifying the number of regimes

  • weight_pars: a vector containing transition weight parameter values.

    • If weight_function == "relative_dens":: a length M-1 vector (α1,...,αM1)(\alpha_1,...,\alpha_{M-1}).

    • If weight_function == "logistic":: a length two vector (c,γ)(c,\gamma), where cRc\in\mathbb{R} is the location parameter and γ>0\gamma >0 is the scale parameter.

    • If weight_function == "mlogit":: a length ((M1)k×1)((M-1)k\times 1) vector (γ1,...,γM1)(\gamma_1,...,\gamma_{M-1}), where γm\gamma_m (k×1)(k\times 1), m=1,...,M1m=1,...,M-1 contains the mlogit-regression coefficients of the mmth regime. Specifically, for switching variables with indices in I{1,...,d}I\subset\lbrace 1,...,d\rbrace, and with p~{1,...,p}\tilde{p}\in\lbrace 1,...,p\rbrace lags included, γm\gamma_m contains the coefficients for the vector zt1=(1,z~min{I},...,z~max{I})z_{t-1} = (1,\tilde{z}_{\min\lbrace I\rbrace},...,\tilde{z}_{\max\lbrace I\rbrace}), where z~i=(yit1,...,yitp~)\tilde{z}_{i} =(y_{it-1},...,y_{it-\tilde{p}}), iIi\in I. So k=1+Ip~k=1+|I|\tilde{p}

       where $|I|$ denotes the number of elements in $I$.
      
    • If weight_function == "exponential":: a length two vector (c,γ)(c,\gamma), where cRc\in\mathbb{R} is the location parameter and γ>0\gamma >0 is the scale parameter.

    • If weight_function == "threshold":: a length M1M-1 vector (r1,...,rM1)(r_1,...,r_{M-1}), where r1,...,rM1r_1,...,r_{M-1} are the threshold values in an increasing order.

    • If weight_function == "exogenous":: of length zero.

  • weight_function: What type of transition weights αm,t\alpha_{m,t} should be used?

    • "relative_dens":: c("alpham,t=\n\\alpha_{m,t}=\n", "fracalphamfm,dp(yt1,...,ytp+1)sumn=1Malphanfn,dp(yt1,...,ytp+1) \\frac{\\alpha_mf_{m,dp}(y_{t-1},...,y_{t-p+1})}{\\sum_{n=1}^M\\alpha_nf_{n,dp}(y_{t-1},...,y_{t-p+1})}"), where αm(0,1)\alpha_m\in (0,1) are weight parameters that satisfy m=1Mαm=1\sum_{m=1}^M\alpha_m=1 and fm,dp()f_{m,dp}(\cdot) is the dpdp-dimensional stationary density of the mmth regime corresponding to pp

       consecutive observations. Available for Gaussian conditional distribution only.
      
    • "logistic":: M=2M=2, α1,t=1α2,t\alpha_{1,t}=1-\alpha_{2,t}, and α2,t=[1+exp{γ(yitjc)}]1\alpha_{2,t}=[1+\exp\lbrace -\gamma(y_{it-j}-c) \rbrace]^{-1}, where yitjy_{it-j} is the lag jj

       observation of the $i$th variable, $c$ is a location parameter, and $\gamma > 0$ is a scale parameter.
      
    • "mlogit":: c("alpham,t=fracexplbracegammamzt1rbrace\n\\alpha_{m,t}=\\frac{\\exp\\lbrace \\gamma_m'z_{t-1} \\rbrace}\n", "sumn=1Mexplbracegammanzt1rbrace {\\sum_{n=1}^M\\exp\\lbrace \\gamma_n'z_{t-1} \\rbrace}"), where γm\gamma_m are coefficient vectors, γM=0\gamma_M=0, and zt1z_{t-1} (k×1)(k\times 1) is the vector containing a constant and the (lagged) switching variables.

    • "exponential":: M=2M=2, α1,t=1α2,t\alpha_{1,t}=1-\alpha_{2,t}, and α2,t=1exp{γ(yitjc)}\alpha_{2,t}=1-\exp\lbrace -\gamma(y_{it-j}-c) \rbrace, where yitjy_{it-j} is the lag jj

       observation of the $i$th variable, $c$ is a location parameter, and $\gamma > 0$ is a scale parameter.
      
    • "threshold":: αm,t=1\alpha_{m,t} = 1 if rm1<yitjrmr_{m-1}<y_{it-j}\leq r_{m} and 00 otherwise, where r0<r1<<rM1<rM-\infty\equiv r_0<r_1<\cdots <r_{M-1}<r_M\equiv\infty are thresholds yitjy_{it-j} is the lag jj

       observation of the $i$th variable.
      
    • "exogenous":: Exogenous nonrandom transition weights, specify the weight series in weightfun_pars.

    See the vignette for more details about the weight functions.

  • weight_constraints: a list of two elements, RR in the first element and rr in the second element, specifying linear constraints on the transition weight parameters α\alpha. The constraints are of the form α=Rξ+r\alpha = R\xi + r, where RR is a known (a×l)(a\times l)

    constraint matrix of full column rank (aa is the dimension of α\alpha), rr is a known (a×1)(a\times 1) constant, and ξ\xi is an unknown (l×1)(l\times 1) parameter. Alternatively , set R=0R=0 to constrain the weight parameters to the constant rr (in this case, α\alpha is dropped from the constrained parameter vector).

  • accuracy: a positive real number adjusting how close to the given parameter vector the returned individual should be. Larger number means larger accuracy. Read the source code for details.

Returns

Returns a numeric vector ...

  • If weight_function == "relative_dens":: a length M-1 vector (α1,...,αM1)(\alpha_1,...,\alpha_{M-1}).

  • If weight_function == "logistic":: a length two vector (c,γ)(c,\gamma), where cRc\in\mathbb{R} is the location parameter and γ>0\gamma >0 is the scale parameter.

  • If weight_function == "mlogit":: a length ((M1)k×1)((M-1)k\times 1) vector (γ1,...,γM1)(\gamma_1,...,\gamma_{M-1}), where γm\gamma_m (k×1)(k\times 1), m=1,...,M1m=1,...,M-1 contains the mlogit-regression coefficients of the mmth regime. Specifically, for switching variables with indices in I{1,...,d}I\subset\lbrace 1,...,d\rbrace, and with p~{1,...,p}\tilde{p}\in\lbrace 1,...,p\rbrace lags included, γm\gamma_m contains the coefficients for the vector zt1=(1,z~min{I},...,z~max{I})z_{t-1} = (1,\tilde{z}_{\min\lbrace I\rbrace},...,\tilde{z}_{\max\lbrace I\rbrace}), where z~i=(yit1,...,yitp~)\tilde{z}_{i} =(y_{it-1},...,y_{it-\tilde{p}}), iIi\in I. So k=1+Ip~k=1+|I|\tilde{p}

     where $|I|$ denotes the number of elements in $I$.
    
  • If weight_function == "exponential":: a length two vector (c,γ)(c,\gamma), where cRc\in\mathbb{R} is the location parameter and γ>0\gamma >0 is the scale parameter.

  • If weight_function == "threshold":: a length M1M-1 vector (r1,...,rM1)(r_1,...,r_{M-1}), where r1,...,rM1r_1,...,r_{M-1} are the threshold values in an increasing order.

  • If weight_function == "exogenous":: of length zero.

  • Maintainer: Savi Virolainen
  • License: GPL-3
  • Last published: 2025-02-27