         sqn (.sqrt js/Math (count observations))]
     (/ (m - hypothesis) (/ sd sqn))))
 
+(defn z-statistic
+  "hypothesis = ostensible population mean
+  observations = vector"
+  [observations hypothesis]
+  (let [m (mean observations)
+        sd (stdev observations)]
+    (/ (m - hypothesis) sd)))
 
 ;; generate p-values from standard distributions.  UNTESTED beyond api test on front page (which may be fine)
 

         df (- (count observations) 1)
         tail (:tail opts 2)]
     (t->p t-stat df tail))))

  ([test-stat tail]
  (let [one-tailed (js/jStat.normal.cdf test-stat 0 1)]
    (if (= 1 tail) one-tailed (* 2 one-tailed))))
  ([test-stat distro-mean distro-sd tails]
   (let [one-tailed (js/jStat.normal.cdf test-stat distro-mean distro-sd)]
     (if (= 1 tail) one-tailed (* 2 one-tailed)))))


;; actual hypothesis tests.  These are probably the only ones that should be treated as "public" and ever make it to other namespaces.

(defn t-test
  "conduct one-sample t-test. defaults to hypothesized mean = zero and two-tailed test

  takes map of opts including :tail (1 or 2) and :hypothesis."
  ([observations]
   (let [t-stat (t-statistic observations 0)
         df (- (count observations) 1)]
