This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* NAME | |
* | |
* statistics-distributions.js - JavaScript library for calculating | |
* critical values and upper probabilities of common statistical | |
* distributions | |
* | |
* SYNOPSIS | |
* | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*stRank.js | |
* | |
* Copyright (c) 2017 Yuji SODE <yuji.sode@gmail.com> | |
* | |
* This software is released under the MIT License. | |
*/ | |
//it returns a rank object available for the statistical rank test, by a given array A. | |
/* | |
* A=[a0, ..., an]; the all aj in A is numerical data. | |
* rank of x: O.x=[rank,count,true rank]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*it returns value of u estimated with two given array: A and B, for Mann–Whitney U test. | |
* returned value is [u, u approximated with standard normal distribution, the maximum sample size]. | |
* reference: | |
* Mann, H. B., and Whitney, D. R. 1947. On a Test of Whether one of Two Random Variables is Stochastically Larger than the Other. Ann. Math. Statist. vol. 18 , no. 1, p. 50-60. | |
*/ | |
var uCal=function(A,B){ | |
//A=[a0, ..., an] and B=[b0, ..., bn]; the all element in both Arrays is numerical data. | |
var slf=this.window,C=[],R2=0,I=0,u=0,u1=0,u2=0,n1=A.length,n2=B.length,Obj; | |
//------------------------------------------------------ | |
//it returns a rank object available for the statistical rank test, by a given array A. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//csv2GnuplotData.js | |
//it converts csv formatted text data into tab separated data for gnuplot | |
function csv2GnuplotData(title,csv){ | |
var slf=this.window,_csvD=csv.split(/,/),N=_csvD.length,I=0,txt='#'+title+'\n'+'#N='+N+'\n'; | |
var saveD=function(a){slf.location.href='data:application/octet-stream,'+encodeURIComponent(a);}; | |
while(I<N){txt+=I+'\t'+_csvD[I]+'\n',I+=1;} | |
txt+='#EOF'; | |
saveD(txt); | |
} | |
/* Copyright (c) 2016 Yuji SODE <yuji.sode@gmail.com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//touch2MouseEvt.js | |
//Copyright (c) 2017 Yuji SODE <yuji.sode@gmail.com> | |
//this function simulates mouse event via touch event. | |
function touch2MouseEvt(e){ | |
//e is event object | |
e.preventDefault(); | |
if(!!e.changedTouches&&e.changedTouches.length>0){ | |
var touch0=null, | |
/*function simulates new mouse event*/ | |
newMEvt=function(EventName,tObj,tgt){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//multiCount.js | |
//this function returns function for multiple count | |
function multiCount(){ | |
//n is integer, no less than 0 | |
var mC=function(n){ | |
//n is integer, no less than 0 | |
if(+n<0){throw new Error('n<0');} | |
mC.c[n]=(mC.c[n]!==undefined)?mC.c[n]+1:1; | |
return mC.c; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//touchEvt2mouseEvt.js | |
//Copyright (c) 2017 Yuji SODE <yuji.sode@gmail.com> | |
//Handling clicks with touch event | |
(function(){ | |
var slf=window,events=['touchstart','touchmove','touchend'],i=0,n=events.length, | |
/*this function simulates mouse event via touch event*/ | |
touch2MouseEvt=function(e){ | |
//e is event object | |
e.preventDefault(); | |
if(!!e.changedTouches&&e.changedTouches.length>0){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*=== JSci version 1.2: F-distribution === | |
F(5,20)|p=0.95:2.7108898372096952 | |
F(3,60)|p=0.95:2.7580782958425782 | |
F(3,116)|p=0.95:2.6828094071219026 | |
F(3,120)|p=0.95:2.680167569850269 | |
/*=== JSci ===*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- canvasFrm.html --> | |
<!-- Simple HTML framework using two canvas tags. --> | |
<!DOCTYPE html><html lang='en'> | |
<head> | |
<meta charset='utf-8'> | |
<title>canvasFrm</title> | |
<style type='text/css'>canvas{border:1px solid #000f;}</style> | |
</head> | |
<body> | |
<div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*nXmGen.js | |
* | |
* Copyright (c) 2017 Yuji SODE <yuji.sode@gmail.com> | |
* | |
* This software is released under the MIT License. | |
*/ | |
//function returns array formatted random n x m data map. | |
/* | |
* e.g., random 3 x 3 data map = ["010","111","101"] | |
* - n: data map width |
OlderNewer