   (idx [1 2 3]) => [1 2 3])
 
 (fact
-  (windowed-map ols-trend 2 [1 2 50]) => (apply roughly [1. 48.]))
+  (first (windowed-map ols-trend 2 [1 2 50])) => (roughly (first [1. 48.])))
+(fact
+  (last (windowed-map ols-trend 2 [1 2 50])) => (roughly (last [1. 48.])))
 
 (fact
   (transpose [[1 2 3] [4 5 6]] ) => [[1 4] [2 5] [3 6]])

(ns forma.trends.analysis-test
  (:use [forma.trends.analysis] :reload)
  (:use midje.sweet
        [forma.presentation.ndvi-filter :only (ndvi reli rain Yt)])
  (:require [incanter.core :as i]

 3      2    [1 2 3 4 3 2 0] (roughly -1.25))

(fact
  "check expt-residuals"
  (let [y Yt
        X (idx Yt)
        power 2]
    (last (expt-residuals y X power))) => 0.04430432657988476)

(tabular
 (fact
   "check scaled-vector"
   (scaled-vector ?scalar ?coll) => ?expected)
 ?scalar ?coll ?expected
 1 [1 2 3] [1 2 3]
 2 [1 2 3] [2 4 6]
 1.5 [1 2 3] [1.5 3.0 4.5]
 )

(defn still-to-do
  "long-stats
   first-order-conditions
   hansen-mats
   trend-stats
   harmonic-series
   k-harmonic-matrix
   harmonic-seasonal-decomposition
  "

  )
