   [ts]
   (let [avg-seq (repeat (count ts) (average ts))
         X    (seasonal-matrix (count ts))
-        fix  (i/mmult (variance-matrix X) (i/trans X) ts)
-        adj  (i/mmult (i/sel X :except-cols 0) (i/sel fix :except-rows 0))]
+        fix  (i/mmult (variance-matrix X)
+                      (i/trans X)
+                      ts)
+        adj  (i/mmult (i/sel X :except-cols 0)
+                      (i/sel fix :except-rows 0))]
     (i/minus ts adj)))
 
 ;; Hodrick-Prescott filter

          (insert-into-zeros idx T (cond (= x 0)  [1 2 -1]
                                         (= x 1)  [-2 5 4 1]
                                         :else [1 -4 6 -4 1])))]
    (i/matrix (concat but-2 (map reverse [second first])))))

(defn hp-filter
  "return a smoothed time-series, given the HP filter parameter."

;; De-seasonalize time-series

(defn seasonal-rows [n]
  "lazy sequence of monthly dummy vectors."
  (->> (cycle (cons 1 (repeat 11 0)))
       (partition 11 1)
       (take n)
       vec))

(defn seasonal-matrix
  "create a matrix of [num-months]x11 of monthly dummies, where
