Skip to content

Commit

Permalink
Merge pull request #6 from YujiSODE/branchY20160912
Browse files Browse the repository at this point in the history
Branch y20160912
  • Loading branch information
YujiSODE authored Sep 12, 2016
2 parents 3bf4ca5 + f554250 commit 7e84b9f
Show file tree
Hide file tree
Showing 7 changed files with 246 additions and 2 deletions.
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,63 @@
#Change Log

## [3.0] - 2016-09-12
##Added
- [subStatDist.js] line 54: ` lk2=f('a','link2'+r9,tDiv.id),lk2.innerHTML='<br>1-sample t-test',lk2.href='./testingFtU3.html';`

##Changed
- [subStatDist.js] line 20: `var B,tDiv,fm,fmR,lbA,ipA,lbB,ipB,Btn,TxtALb,txtA,br01,restB,adrsLbl,adrs,sbmtB,t,D=[],lk,lk2;`
- [testingFtU.html] line 24: ` <h3>F-test, t-test, and U-test with two numerical arrays</h3>`
- [testingFtU2.html] line 2: `<title>testingFtU@bootstrap_simulation</title>`

##Added
- [testingFtU2.html] line 26: ` <h3>F-test, t-test, and U-test with bootstrap simulation</h3>`

## [3.0] - 2016-09-10
##Changed
- [statDist3.js] line 45-47 in statDist2.js: ` X/=N;`
` slf.postMessage({t:X,p:P});`
` c=dBts=P=null;`
- [statDist3.js] line 43 in statDist2.js: ` X+=P[I]<d4?1:0;`

##Removed
- [statDist3.js] line 44-46 in statDist2.js
- [statDist3.js] line 43 in statDist2.js

##Changed
- [statDist3.js] line 36-39 in statDist2.js: `I=0;while(I<d3){`
` dBts=bootstrap(d0,d2),c=t_1spl(dBts,d1);`
` //P=[p-value for t]`
` P[I]=tprob(c[1],c[0]);`

##Added
- [statDist3.js] line 25 in statDist2.js: ` //=== <t value for 1-sample t-test> ===`
` t_1spl=function(A,m){`
` //A and m are numerical array and given mean value respectively.`
` var v=0,I=0,av=0,s2=0,n=A.length;`
` while(I<n){v+=A[I],I+=1;}`
` av=v/n,I=0,v=0;`
` while(I<n){v+=(A[I]-av)*(A[I]-av),I+=1;}`
` s2=v/(n-1);`
` return [(av-m)/Math.sqrt(s2/n),n-1];};`
` //=== <t value for 1-sample t-test> ===`

##Removed
- [statDist3.js] line 24 in statDist2.js

##Changed
- [statDist3.js] line 23 in statDist2.js: ` var t_1spl,c,d=e.data.split('@'),d0=d[0].split(','),d1=+d[1],d2=+d[2],d3=+d[3],d4=+d[4],I=0,N=0,dBts,P=[],X=0;`
- [statDist3.js] line 2 in statDist2.js: `* statDist3.js`
- [statDist3.js] line 19-20 in statDist2.js: `//the available data format is csv formatted numerical arrays, given mean value, time of simulation and significance level (0 to 1), separated with '@' as follows:`
`// e.g., '0,1,2@1@10@0.025'`
- [statDist3.js] line 17 in statDist2.js: `//{t:[(t<crit)/T],p:[p(t), ..., p(t)]}`
- [statDist3.js] line 15 in statDist2.js: `//this is Web Worker interface for statistical test (1-sample t-test) with bootstrap method.`

##Removed
- [statDist3.js] line 53-60 in statDist2.js

##Added
- added files: statDist3.js modified from statDist2.js (Yuji SODE,2016), subStatDist3.js, and testingFtU3.html

## [2.0] - 2016-08-31
##Changed
- [README.md]: updated README.md
Expand Down
64 changes: 64 additions & 0 deletions statDist3.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion subStatDist.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var slf=this.window,W,r9=slf.Math.random().toFixed(9).replace(/\./g,''),cObj;
return t.appendChild(E);
};
//=========================
var B,tDiv,fm,fmR,lbA,ipA,lbB,ipB,Btn,TxtALb,txtA,br01,restB,adrsLbl,adrs,sbmtB,t,D=[],lk;
var B,tDiv,fm,fmR,lbA,ipA,lbB,ipB,Btn,TxtALb,txtA,br01,restB,adrsLbl,adrs,sbmtB,t,D=[],lk,lk2;
B=slf.document.getElementsByTagName('body')[0];B.id='B'+r9;
tDiv=f('div','div'+r9,B.id),B.removeAttribute('id');
//<form>
Expand Down Expand Up @@ -51,6 +51,7 @@ var B,tDiv,fm,fmR,lbA,ipA,lbB,ipB,Btn,TxtALb,txtA,br01,restB,adrsLbl,adrs,sbmtB,
},true);
//</output as email>
lk=f('a','link'+r9,tDiv.id),lk.innerHTML='<br>Test with bootstrap method',lk.href='./testingFtU2.html';
lk2=f('a','link2'+r9,tDiv.id),lk2.innerHTML='<br>1-sample t-test',lk2.href='./testingFtU3.html';
//============ web worker ============
W=new Worker('./statDist.js');
W.addEventListener('error',function(e){console.log(e.message),W.terminate();},true);
Expand Down
90 changes: 90 additions & 0 deletions subStatDist3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*testingFtU
* subStatDist3.js
*
* Copyright (c) 2016 Yuji SODE <yuji.sode@gmail.com>
* https://github.com/YujiSODE/testingFtU
*
* This is released under the Artistic License.
* See http://dev.perl.org/licenses/ and http://dev.perl.org/licenses/artistic.html
* or LICENSE.
*/
(function(){
var slf=this.window,W,r9=slf.Math.random().toFixed(9).replace(/\./g,''),cObj;
//=== element generator ===
var f=function(elName,elId,targetId){
var t=slf.document.getElementById(targetId),E=slf.document.createElement(elName);
E.id=elId;
return t.appendChild(E);
};
//=========================
var B,tDiv,fm,fmR,lbA,ipA,lbM,ipM,lbSSize,ipSSize,lbTSm,ipTSm,lbAlpha,ipAlpha,Btn,TxtALb,txtA,br01,restB,adrsLbl,adrs,sbmtB,t,D=[],lk;
B=slf.document.getElementsByTagName('body')[0];B.id='B'+r9;
tDiv=f('div','div'+r9,B.id),B.removeAttribute('id');
//<form>
fm=f('form','fm'+r9,tDiv.id);
fmR=f('form','fmR'+r9,tDiv.id);
fmR.name='statistical test';
fmR.action='mailto:123.example@qwerty.com?subject='+slf.document.getElementsByTagName('title')[0].innerHTML;
fmR.method='post';
fmR.enctype='text/plain';
//</form>
//<resampling from>
lbA=f('label','labelA'+r9,fm.id),lbA.innerHTML='<br>Resampling from:';
ipA=f('input','inputA'+r9,lbA.id),ipA.type='text',ipA.value='0,1,2';
//</resampling from>
//<given mean value>
lbM=f('label','labelM'+r9,fm.id),lbM.innerHTML='<br>Given mean:';
ipM=f('input','inputM'+r9,lbM.id),ipM.type='number',ipM.step=0.01,ipM.value=1;
//</given mean value>
//<given sample size>
lbSSize=f('label','labelSSize'+r9,fm.id),lbSSize.innerHTML='<br>Resampling size:';
ipSSize=f('input','inputSSize'+r9,lbSSize.id),ipSSize.type='number',ipSSize.min=1,ipSSize.step=1,ipSSize.value=20;
//</given sample size>
//<time of simulation>
lbTSm=f('label','labelTSm'+r9,fm.id),lbTSm.innerHTML='<br>Time of simulation:';
ipTSm=f('input','inputTSm'+r9,lbTSm.id),ipTSm.type='number',ipTSm.min=1,ipTSm.step=1,ipTSm.value=10;
//</time of simulation>
//<significance level>
lbAlpha=f('label','labelAlpha'+r9,fm.id),lbAlpha.innerHTML='<br>Significance level:';
ipAlpha=f('input','inputAlpha'+r9,lbAlpha.id),ipAlpha.type='number',ipAlpha.min=0,ipAlpha.max=1,ipAlpha.step=0.001,ipAlpha.value=0.025;
//</significance level>
Btn=f('input','Btn'+r9,fm.id),Btn.type='button',Btn.value='Run';
//<output as email>
TxtALb=f('label','labelTxtArea'+r9,fmR.id),TxtALb.innerHTML='<br>Result:';
txtA=f('textarea','result'+r9,TxtALb.id),txtA.name='Result';
br01=f('br','br01_'+r9,fmR.id);
restB=f('input','resetB'+r9,fmR.id),restB.type='button',restB.value='Clear';
adrsLbl=f('label','adrsLbl'+r9,fmR.id),adrsLbl.innerHTML='<br>Email address:';
adrs=f('input','adrs'+r9,adrsLbl.id),adrs.type='email',adrs.value='123.example@qwerty.com';
sbmtB=f('input','submitB'+r9,fmR.id),sbmtB.type='submit',sbmtB.value='Output as email';
adrs.addEventListener('change',function(){
var F=slf.document.getElementById(fmR.id);
F.action='mailto:'+this.value+'?subject='+slf.document.getElementsByTagName('title')[0].innerHTML+': '+slf.Date().replace(/\s/g,'_');
},true);
//</output as email>
lk=f('a','link'+r9,tDiv.id),lk.innerHTML='<br>2 sample test',lk.href='./testingFtU.html';
restB.addEventListener('click',function(){
slf.document.getElementById(txtA.id).value='';
},true);
//============ web worker ============
W=new Worker('./statDist3.js');
W.addEventListener('error',function(e){console.log(e.message),W.terminate();},true);
W.addEventListener('message',function(e){
var output='1-sample t-test\n',d=e.data,n=d.p.length;
t=slf.document.getElementById(txtA.id);
output+='Rejection rate:'+d.t+'\n<Details: p value>\n';
for(var i=0;i<n;i+=1){output+=d.p[i]+'\n';}
t.value+=output;
},true);
Btn.addEventListener('click',function(){
t=slf.document.getElementById(txtA.id);
//e.g, D=['0,1,2',1,20,10,0.025]
D[0]=slf.document.getElementById(ipA.id).value;
D[1]=slf.document.getElementById(ipM.id).value;
D[2]=slf.document.getElementById(ipSSize.id).value;
D[3]=slf.document.getElementById(ipTSm.id).value;
D[4]=slf.document.getElementById(ipAlpha.id).value;
W.postMessage(D.join('@'));
t.value+='<Sample size:'+D[0].split(',').length+'>\n[Resampled size:'+D[2]+';Given mean:'+D[1]+';\nSimulation:'+D[3]+'times;\nSignificance level:'+D[4]+']\n'
},true);
}());
1 change: 1 addition & 0 deletions testingFtU.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
</style>
</head>
<body>
<h3>F-test, t-test, and U-test with two numerical arrays</h3>
<script type='text/javascript' src='./subStatDist.js'></script>
</body>
</html>
3 changes: 2 additions & 1 deletion testingFtU2.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html><html><head><meta charset='utf-8'>
<title>testingFtU@bootstrap simulation</title>
<title>testingFtU@bootstrap_simulation</title>
<!--Copyright (C) 2016 Yuji SODE-->
<!-- This is released under the Artistic License. -->
<!-- See http://dev.perl.org/licenses/ and http://dev.perl.org/licenses/artistic.html or LICENSE. -->
Expand All @@ -23,6 +23,7 @@
</style>
</head>
<body>
<h3>F-test, t-test, and U-test with bootstrap simulation</h3>
<script type='text/javascript' src='./subStatDist2.js'></script>
</body>
</html>
29 changes: 29 additions & 0 deletions testingFtU3.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!doctype html><html><head><meta charset='utf-8'>
<title>testingFtU@1-sample_t-test</title>
<!--Copyright (C) 2016 Yuji SODE-->
<!-- This is released under the Artistic License. -->
<!-- See http://dev.perl.org/licenses/ and http://dev.perl.org/licenses/artistic.html or LICENSE. -->
<!-- Statistical test(1-sample t-test) with a numerical array and bootstrap simulation -->
<!-- https://github.com/YujiSODE/testingFtU -->
<!-- Library list -->
<!-- statDist.js (Yuji SODE,2016): the Artistic License or the GPL v1 or later;
https://github.com/YujiSODE/statDist -->
<!-- statistics-distributions-js_Ymdf.js (Ben Tilly,2008; modified by Yuji SODE, 2016):
the Artistic License or the GPL v1 or later;
https://github.com/YujiSODE/statistics-distributions-js_Ymdf -->
<!-- calcStat_FtU.js (Yuji SODE, 2016): the MIT License;
https://github.com/YujiSODE/calcStat_FtU -->
<!-- bootstrapEst-2.1/bootstrapMdl.js (Yuji SODE,2016): the MIT License;
https://github.com/YujiSODE/bootstrapEst -->
<style type='text/css'>
body{background:rgba(255,255,255,1);color:rgba(0,0,0,1);font-size:25px;}
input{background:rgba(255,255,255,1);color:rgba(0,0,0,1);font-size:25px;}
textarea{background:rgba(255,255,255,1);color:rgba(0,0,0,1);font-size:25px;
overflow:scroll;resize:both;}
</style>
</head>
<body>
<h3>1-sample_t-test</h3>
<script type='text/javascript' src='./subStatDist3.js'></script>
</body>
</html>

0 comments on commit 7e84b9f

Please sign in to comment.