<commit_before>(ns statspop.core
  (:require [reagent.core :as r]
            [statspop.charts.core :as c]
            [statspop.charts.scatter :as sp]
            [statspop.charts.hist :as hist]
            [statspop.math.matrix :as matrix]
            [statspop.detection :as detection]
            [devcards.core])
  (:require-macros [devcards.core :as dc :refer [defcard deftest defcard-rg]]))


;; experimenting with jstat
(def test-mini (js/jStat (clj->js [[1 2] [3 4] [5 6]])))

(defn test-jstat [arr]
  (str (js/jStat.dimensions (js/jStat arr))))

(defn test-jstat-distri-api []
  (str "calling cdf function: "
       (js/jStat.chisquare.cdf 14.067 7) ; test statistic -> p-value
       " calling inverse function: "
       (js/jStat.chisquare.inv .95 7))) ; p-value -> test-statistic

(defcard-rg test-card
  "testing devcards"
   [:div
    [:h1 "This is your first devcard!"]])

;; (.log js/console test-mini)
;; (.log js/console (.dimensions test-mini))

;; experimenting with google closure math
<commit_msg>try out some more stats stuff<commit_after>(ns statspop.core
  (:require [reagent.core :as r]
            [statspop.charts.core :as c]
            [statspop.charts.scatter :as sp]
            [statspop.charts.hist :as hist]
            [statspop.math.matrix :as matrix]
            [statspop.detection :as detection]
            [devcards.core])
  (:require-macros [devcards.core :as dc :refer [defcard deftest defcard-rg]]))


;; experimenting with jstat
(def test-mini (js/jStat (clj->js [[1 2] [3 4] [5 6]])))

(defn test-jstat [arr]
  (str (js/jStat.dimensions (js/jStat arr))))

(defn test-jstat-distri-api []
  (str "chi-square cdf function (test-stat->p - should be .05): "
       (js/jStat.chisquare.cdf 14.067 7)
       " | chi-square inverse function (p->test-stat - should be 14.067): "
       (js/jStat.chisquare.inv .95 7)
       " | ONE-TAILED t-test-square cdf function (test-stat->p): "
       (js/jStat.studentt.cdf 1.895 7) 
       " | ONE-TAILED t-test-square inverse function (p->test-stat): "
       (js/jStat.studentt.inv .95 7)
       " | STANDARDIZED ONE-TAILED z-test(normal)-square cdf function (test-stat->p): "
       (js/jStat.normal.cdf 1.645 0 1) 
       " | STANDARDIZED ONE-TAILED z-test(normal)-square inverse function (p->test-stat): "
       (js/jStat.normal.inv .95 0 1)
       ))

;; these above are all correct.  for p-values, I'm working with percentiles so need to subtract these percentiles from 1.  For two-tailed t-test, I should just double the p value.  Don't really need to provide p-value -> test statistic functions, should just provide test-stat to p-value functions. For z-scores, this is all standardized.  parameters for chi square and t are test statistic and degrees of freedom; parameters for normal are test statistic, mean, and sd.

;; should also add f-distro for anova. it's all in jStat.centralF and parameters are test stat, df1, and df2. 

(defcard-rg test-card
  "testing devcards"
   [:div
    [:h1 "This is your first devcard!"]])

;; (.log js/console test-mini)
;; (.log js/console (.dimensions test-mini))

;; experimenting with google closure math

{'fraction_non_alphanumeric': 0.1373924131335671, 'fraction_numerical': 0.01912655403251514, 'mean_word_length': 2.8268292682926828, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '340677', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1066, 'n_words': 321}