/stat-knife

A Convenient Knife for Statistical Operations

Primary LanguageJavaScriptMIT LicenseMIT

stat-knife - A Convenient Knife for Statistical Operations

Copyright 2019- Tatsuhiro Aoshima (hiro4bbh@gmail.com).

Introduction

stat-knife is a convenient knife for statistical operations. It will also provide many features supported by modern Web browsers in many development environments.

Features

  • Use the interactive JavaScript (ES6) console on Electron
  • Implement the simple panel manager for summaries or plots with D3
  • Save the contents of a panel in HTML/SVG/PNG
  • Support the simple data manipulations
  • Support the simple random number generators
  • Support the markdown rendering with markdown-it and the LaTeX rendering with KaTeX
  • Load the user configuration script at $HOME/.stat-knife/init.js

Showcases

iris = StatKnife.DataSet.readIris()
iris.summary().show()
iris.filter([0, 50, 100]).show()
StatKnife.attach(iris).histogram('SepalLength').groupBy('Species').show()
StatKnife.attach(iris).plot('SepalWidth', 'SepalLength').groupBy('Species').show()

screenshot 1 screenshot 2 screenshot 3 screenshot 4

dice = new StatKnife.Dice(20190216)
sampleNorm = Array(100000).fill(0.0).map((_, i) => dice.normalDist()())
sampleNorm.summary().show()
StatKnife.attach(sampleNorm).histogram('value').thresholds(100).show()

screenshot 5

canvas = (new StatKnife.CanvasPanel()).show()
canvas.context.fillStyle = '#ff000088'; canvas.context.fillRect(50, 50, 250, 250)
canvas.context.fillStyle = '#0000ff88'; canvas.context.fillRect(200, 200, 250, 250)

screenshot 6

StatKnife.markdown().text(String.raw`
Everything starts with complex numbers and Euler's formula: $e^{i\theta} = \cos\theta + i\sin\theta$.

We can show that the well-known relations:

~~~tex
\begin{aligned}
  1 &= e^0 = e^{i\theta}e^{-i\theta} = \cos^2\theta + \sin^2\theta \\
  \sin(\alpha + \beta) &= \mathrm{Im}(e^{i\alpha}e^{i\beta}) = \sin\alpha\cos\beta + \cos\alpha\sin\alpha
\end{aligned}
~~~

...
`).show()
StatKnife.markdown().textFromFile('./README.md').show()

screenshot 7

Installation and Development

The latest Visual Studio Code (VSCode) is recommended for developing stat-knife. VSCode provides a compact and fast development environment, including the terminal!

At first, install node.js. Then, download stat-knife in your terminal as follows:

$ git clone https://github.com/hiro4bbh/stat-knife

Install the packages depended on by stat-knife in your terminal at ./stat-knife as follows:

$ npm install

Start stat-knife in your terminal at ./stat-knife as follows:

$ npm start

TODO

  • Prepare documentations.
  • Write unit tests.
  • Prepare stat-knife logo.
  • Implement more statistical functions.
  • Tweak visual styles and plot options.
  • Prepare release packages.