LocLinear: Local linear Regression

View source: R/RcppExports.R

LocLinearR Documentation

Local linear Regression

Description

Local linear estimates for time varying coefficients

Usage

LocLinear(bw, t, y, X, db_kernel = 0L, deriv2 = 0L, scb = 0L)

Arguments

bw

double, bandwidth

t

vector, time, 1:n/n

y

vector, response series to be tested for long memory in the next step

X

matrix, covariates matrix

db_kernel

bool, whether to use jackknife kernel, default 0

deriv2

bool,whether to return second-order derivative, default 0

scb

bool, whether to use the result for further calculation of simultaneous confidence bands.

Details

The time varying coefficients are estimated by \mjsdeqn(\hat\boldsymbol\beta_b_n(t), \hat\boldsymbol\beta_b_n^\prime(t)) = \mathbfarg min_\eta_0,\eta_1[\sum_i=1^n{y_i-\mathbfx_i^\mathrmT\eta_0-\mathbfx_i^\mathrmT \eta_1(t_i-t)}^2 \boldsymbolK_b_n(t_i-t)] where beta0 is \mjseqn\hat\boldsymbol\beta_b_n(t), mu is \mjseqnX^T \hat\boldsymbol\beta_b_n(t)

Value

a list of results

  • mu: the estimated trend

  • beta0: time varying coefficient

  • X_reg: a matrix whose j'th row is \mjseqnx_j^T\hatM(t_j)

  • t: 1:n/n

  • bw: bandwidth used

  • X: covariates matrix

  • y: response

  • n: sample size

  • p: dimension of covariates including the intercept

  • invM: inversion of M matrix, when scb = 1

References

Zhou, Z., & Wu, W. B. (2010). Simultaneous inference of linear models with time varying coefficients. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 72(4), 513-531.

Examples

param = list(d = -0.2, heter = 2, tvd = 0,
 tw = 0.8, rate = 0.1, cur = 1, center = 0.3,
  ma_rate =  0, cov_tw =  0.2, cov_rate = 0.1,
   cov_center = 0.1, all_tw  = 1, cov_trend = 0.7)
n = 500
t = (1:n)/n
data = Qct_reg(n, param)
result = LocLinear(0.2, t, data$y, data$x)

mlrv documentation built on Sept. 11, 2024, 6:57 p.m.