# Nonparametric Time Series Forecasting

I am trying to understand how Kernel Density Estimation (KDE) or (nonparametric) Quantile Regression can be used to forecast values given historical observations. For example, consider the following nonparametric regression model

$Y_t = g(X_t) + u_t$

where $X_t = (Y_{t - 1}, \ldots, Y_{t - q})$. In the following equation (one-step-ahead forecasting)

$\hat{Y}_{n + t,1} \equiv \hat{\text{E}}(Y_{n + t}|X_{n + t}) = \dfrac{\sum_{j = q + t}^{n + t - 1}Y_jK_h(X_j - X_{n + t})}{\sum_{j = q + t}^{n + t - 1}K_h(X_j - X_{n + t})}$

where $K_h(X_j - X_{n + t}) = \prod_{s = 1}^q h_s^{-1}k((Y_{j - s} - Y_{n + t - s})/h_s)$, it doesn't seem to me that the order of the observations is taken into account when evaluating the kernel function at previous observations. Shouldn't it matter? Otherwise, it seems to me that observations in previous time periods are just treated as i.i.d. data (no time structure). Similarly to the prediction of future quantiles if I were to use the function npqreg in the R np package for time series data.