all set-up to prepare ultimate test before last reports
[talweg.git] / pkg / R / F_Neighbors.R
index f1aecb5..3abd0ff 100644 (file)
@@ -164,17 +164,16 @@ NeighborsForecaster = setRefClass(
                        {
                                h_exo = ifelse(simtype=="mix", h[2], h)
 
-                               # TODO: [rnormand] if predict_at == 0h then we should use measures from day minus 1
-                               M = matrix( nrow=1+length(fdays_indices), ncol=1+length(dat[[today]]$exo_hat) )
-                               M[1,] = c( dat[[today]]$level, as.double(dat[[today]]$exo_hat) )
+                               M = matrix( nrow=1+length(fdays_indices), ncol=1+length(dat[[today]]$exo) )
+                               M[1,] = c( dat[[today]]$level, as.double(dat[[today]]$exo) )
                                for (i in seq_along(fdays_indices))
                                {
                                        M[i+1,] = c( dat[[ fdays_indices[i] ]]$level,
-                                               as.double(dat[[ fdays_indices[i] ]]$exo_hat) )
+                                               as.double(dat[[ fdays_indices[i] ]]$exo) )
                                }
 
                                sigma = cov(M) #NOTE: robust covariance is way too slow
-                               sigma_inv = qr.solve(sigma)
+                               sigma_inv = solve(sigma) #TODO: use pseudo-inverse if needed?
 
                                # Distances from last observed day to days in the past
                                distances2 = rep(NA, nrow(M)-1)