tvGLS: Time-Varying Generalised Least Squares

View source: R/tvGLS.R

tvGLSR Documentation

Time-Varying Generalised Least Squares

Description

tvGLS estimates time-varying coefficients of SURE using the kernel smoothing GLS.

tvGLS is used to estimate time-varying coefficients SURE using the kernel smoothing generalised least square.

Usage

tvGLS(x, ...)

## S3 method for class 'list'
tvGLS(
  x,
  y,
  z = NULL,
  ez = NULL,
  bw,
  Sigma = NULL,
  R = NULL,
  r = NULL,
  est = c("lc", "ll"),
  tkernel = c("Triweight", "Epa", "Gaussian"),
  ...
)

## S3 method for class 'matrix'
tvGLS(
  x,
  y,
  z = NULL,
  ez = NULL,
  bw,
  Sigma = NULL,
  R = NULL,
  r = NULL,
  est = c("lc", "ll"),
  tkernel = c("Triweight", "Epa", "Gaussian"),
  ...
)

## S3 method for class 'tvsure'
tvGLS(x, ...)

Arguments

x

An object used to select a method.

...

Other arguments passed to specific methods.

y

A matrix.

z

A vector with the smoothing variable.

ez

(optional) A scalar or vector with the smoothing values. If values are not included then the vector z is used instead.

bw

A numeric vector.

Sigma

An array.

R

A matrix.

r

A numeric vector.

est

The nonparametric estimation method, one of "lc" (default) for linear constant or "ll" for local linear.

tkernel

A character, either "Triweight" (default), "Epa" or "Gaussian" kernel function.

Details

The classical GLS estimator must be modified to generate a set of coefficients changing over time. The tvGLS finds a GLS estimate at a given point in time t using the data near by. The size of the data window used is given by the bandwidth. The closest a point is to t, the larger is its effect on the estimation which is given by the kernel. In this programme, the three possible kernels are the Triweight, Epanechnikov and Gaussian. As in the classical GLS, the covariance matrix is involved in the estimation formula. If this matrix is NULL or the identity, then the program returns the OLS estimates for time-varying coefficients.

Note, that unless with the tvSURE, the tvGLS may run with one common bandwidth for all equations or with a different bandwidths for each equation.

Value

tvGLS returns a list containing:

coefficients

An array of dimension obs x nvar x neq (obs = number of observations, nvar = number of variables in each equation, neq = number of equations in the system) with the time-varying coefficients estimates.

fitted

A matrix of dimension obs x neq with the fitted values from the estimation.

residuals

A matrix of dimension obs x neq with the residuals from the estimation.

Examples

data(FF5F)
x <- list()
## SMALL/LoBM porfolios time-varying three factor model
x[[1]] <- cbind(rep (1, 314), FF5F[, c("NA.Mkt.RF", "NA.SMB",  "NA.HML", "NA.RMW", "NA.CMA")])
x[[2]] <- cbind(rep (1, 314), FF5F[, c("JP.Mkt.RF", "JP.SMB",  "JP.HML", "JP.RMW", "JP.CMA")])
x[[3]] <- cbind(rep (1, 314), FF5F[, c("AP.Mkt.RF", "AP.SMB",  "AP.HML", "AP.RMW", "AP.CMA")])
x[[4]] <- cbind(rep (1, 314), FF5F[, c("EU.Mkt.RF", "EU.SMB",  "EU.HML", "EU.RMW", "EU.CMA")])
##Returns
y <- cbind(FF5F$NA.SMALL.LoBM, FF5F$JP.SMALL.LoBM, FF5F$AP.SMALL.LoBM, 
FF5F$EU.SMALL.LoBM) 
##Excess returns
y <- y - cbind(FF5F$NA.RF, FF5F$JP.RF, FF5F$AP.RF, FF5F$EU.RF)
##I fit the data with one bandwidth for each equation
FF5F.fit <- tvGLS(x = x, y = y, bw = c(1.03, 0.44, 0.69, 0.31))


tvReg documentation built on Sept. 1, 2023, 5:07 p.m.