# --- Nadaraya–Watson predictions at Xnew using training (Xtrain, ytrain) -
ARCHmX_predict_nw_iso <- function(Xtrain, ytrain, Xnew, h) {
  K <- ARCHmX_kernel_between_iso(Xnew, Xtrain, h)     # n_new x n_train
  num <- as.vector(K %*% ytrain)                      # row sums of K * y
  den <- pmax(rowSums(K), .Machine$double.eps)        # avoid divide-by-zero
  num / den
}