tvp function

Computes Time-Varying Parameters Regression.

Computes Time-Varying Parameters Regression.

This function computes Time-Varying Parameters Regression (TVP) with the updating procedure as in Raftery et. al (2010).

tvp(y,x,V,lambda,W=NULL,kappa=NULL,c=NULL)

Arguments

  • y: numeric or a column matrix of a dependent variable
  • x: matrix of independent variables, different columns should correspond to different variables
  • V: numeric, initial variance in the state space equation for the recursive moment estimator updating method, as in Raftery et al. (2010)
  • lambda: numeric, a forgetting factor between 0 and 1 used in variance approximations
  • W: optional, numeric, initial value of variance for the model equations, if not specified the method based on the linear regression, as in Raftery et al. (2010) is used
  • kappa: optional, numeric, a parameter in the exponentially weighted moving average in variance updating (see also fDMA), between 0 and 1, if not specified the method as in Raftery et al. (2010) is used
  • c: optional, logical, a parameter indicating whether constant is included, if not specified c=TRUE is used, i.e., constant is included

Details

It is not possible to set c=FALSE if ncol(x)=0. In such a case the function will automatically reset c=TRUE inside the code.

Returns

class tvp object, list of - $y.hat: fitted (forecasted) values

  • $thetas: estimated regression coefficients

  • $pred.dens.: predicitive densities from each period

  • $y: y, forecasted time-series

Examples

wti <- crudeoil[-1,1] drivers <- (lag(crudeoil[,-1],k=1))[-1,] ld.wti <- (diff(log(wti)))[-1,] ld.drivers <- drivers[-1,] ld.drivers[,c(4,6)] <- (diff(drivers[,c(4,6)]))[-1,] ld.drivers[,c(1:2,5,7)] <- (diff(log(drivers[,c(1:2,5,7)])))[-1,] ld.drivers[,c(3,6)] <- ld.drivers[,c(3,6)]/100 t1 <- tvp(y=ld.wti,x=ld.drivers,V=1,lambda=0.99) t2 <- tvp(y=ld.wti,x=ld.drivers,V=1,lambda=0.99,W=1) t3 <- tvp(y=ld.wti,x=ld.drivers,V=1,lambda=0.99,W=1,kappa=0.75) # Model with constant only empty <- matrix(,nrow=nrow(ld.drivers),ncol=0) t4 <- tvp(y=ld.wti,x=empty,lambda=0.99,V=1)

References

Raftery, A. E., Karny, M., Ettler, P., 2010. Online prediction under model uncertainty via Dynamic Model Averaging: Application to a cold rolling mill. Technometrics 52 , 52--66.

Sanderson, C., Curtin, R., 2016. Armadillo: A template-based C++ library for linear algebra. Journal of Open Source Software 1 , https://arma.sourceforge.net/armadillo_joss_2016.pdf.

See Also

grid.tvp, print.tvp, summary.tvp, plot.tvp.