Skip to content

Commit c30c54c

Browse files
author
minjk-bl
committed
Add statistics apps
1 parent 84896d2 commit c30c54c

File tree

10 files changed

+1171
-55
lines changed

10 files changed

+1171
-55
lines changed

visualpython/css/m_stats/probDist.css

Whitespace-only changes.
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
define([
2+
], function () {
3+
/**
4+
* name
5+
* library
6+
* description
7+
* code
8+
* options: [
9+
* {
10+
* name
11+
* label
12+
* [optional]
13+
* component :
14+
* - 1darr / 2darr / ndarr / scalar / param / dtype / tabblock
15+
* default
16+
* required
17+
* usePair
18+
* code
19+
* }
20+
* ]
21+
*/
22+
var STATS_LIBRARIES = {
23+
/** Discrete prob. dist. */
24+
'bernoulli': {
25+
name: 'Bernoulli',
26+
import: 'from scipy import stats',
27+
code: '_rv = stats.bernoulli(${p})',
28+
description: 'A Bernoulli discrete random variable.',
29+
options: [
30+
{ name: 'p', component: ['input_number'], default: 0.6, usePair: true },
31+
]
32+
},
33+
'binomial': {
34+
name: 'Binomial',
35+
import: 'from scipy import stats',
36+
code: '_rv = stats.binom(${N}${p})',
37+
description: 'A binomial discrete random variable.',
38+
options: [
39+
{ name: 'N', component: ['input_number'], default: 10, usePair: true },
40+
{ name: 'p', component: ['input_number'], default: 0.6, usePair: true },
41+
]
42+
},
43+
'multinomial': {
44+
name: 'Multinomial',
45+
import: 'from scipy import stats',
46+
code: '_rv = stats.multinomial(${N}${mu})',
47+
description: 'A multinomial random variable.',
48+
options: [
49+
{ name: 'N', component: ['input_number'], default: 10, usePair: true },
50+
{ name: 'p', component: ['data_select'], usePair: true },
51+
]
52+
},
53+
/** Continumous prob. dist. */
54+
'uniform': {
55+
name: 'Uniform',
56+
import: 'from scipy import stats',
57+
code: '_rv = stats.uniform()',
58+
description: 'A uniform continuous random variable.',
59+
options: [
60+
]
61+
},
62+
'normal': {
63+
name: 'Normal',
64+
import: 'from scipy import stats',
65+
code: '_rv = stats.norm(${loc}${scale})',
66+
description: 'A normal continuous random variable.',
67+
options: [
68+
{ name: 'loc', component: ['input_number'], default: 0, usePair: true },
69+
{ name: 'scale', component: ['input_number'], default: 1, usePair: true },
70+
]
71+
},
72+
'beta': {
73+
name: 'Beta',
74+
import: 'from scipy import stats',
75+
code: '_rv = stats.beta(${a}${b})',
76+
description: 'A beta continuous random variable.',
77+
options: [
78+
{ name: 'a', component: ['input_number'], usePair: true },
79+
{ name: 'b', component: ['input_number'], usePair: true },
80+
]
81+
},
82+
'gamma': {
83+
name: 'Gamma',
84+
import: 'from scipy import stats',
85+
code: '_rv = stats.gamma(${a})',
86+
description: 'A gamma continuous random variable.',
87+
options: [
88+
{ name: 'a', component: ['input_number'], usePair: true },
89+
]
90+
},
91+
'studentst': {
92+
name: "Student's t",
93+
import: 'from scipy import stats',
94+
code: '_rv = stats.t(${df})',
95+
description: "A Student's t continuous random variable.",
96+
options: [
97+
{ name: 'df', component: ['input_number'], usePair: true },
98+
]
99+
},
100+
'chi2': {
101+
name: 'Chi2',
102+
import: 'from scipy import stats',
103+
code: '_rv = stats.chi2(${df})',
104+
description: 'A chi-squared continuous random variable.',
105+
options: [
106+
{ name: 'df', component: ['input_number'], usePair: true },
107+
]
108+
},
109+
'f': {
110+
name: 'F',
111+
import: 'from scipy import stats',
112+
code: '_rv = stats.f(${dfn}${dfd})',
113+
description: 'An F continuous random variable.',
114+
options: [
115+
{ name: 'dfn', component: ['input_number'], usePair: true },
116+
{ name: 'dfd', component: ['input_number'], usePair: true },
117+
]
118+
},
119+
'dirichlet': {
120+
name: 'Dirichlet',
121+
import: 'from scipy import stats',
122+
code: '_rv = stats.dirichlet(${alpha}${seed})',
123+
description: 'A Dirichlet random variable.',
124+
options: [
125+
{ name: 'alpha', component: ['input_number'], usePair: true },
126+
{ name: 'seed', component: ['input_number'], usePair: true },
127+
]
128+
},
129+
'multivariate_normal': {
130+
name: 'Multivariate normal',
131+
import: 'from scipy import stats',
132+
code: '_rv = stats.multivariate_normal(${mean}${cov}${allow_singular})',
133+
description: 'A multivariate normal random variable.',
134+
options: [
135+
{ name: 'mean', component: ['data_select'], default: '[0]', usePair: true },
136+
{ name: 'cov', component: ['data_select'], default: '[1]', usePair: true },
137+
{ name: 'allow_singular', component: ['bool_select'], default: 'False', usePair: true },
138+
]
139+
},
140+
}
141+
142+
return STATS_LIBRARIES;
143+
});
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!--
2+
Project Name : Visual Python
3+
Description : GUI-based Python code generator
4+
File Name : equalVarTest.html
5+
Author : Black Logic
6+
Note : equal variance test
7+
License : GNU GPLv3 with Visual Python special exception
8+
Date : 2023. 05. 16
9+
Change Date :
10+
-->
11+
<body>
12+
<div class="vp-grid-box">
13+
<select id="testType" class="vp-big-select vp-state">
14+
<option value="bartlett">Bartlett test</option>
15+
<option value="levene">Levene test</option>
16+
<option value="fligner">Fligner test</option>
17+
</select>
18+
<div class="vp-grid-border-box">
19+
<div class="vp-grid-box">
20+
<div class="vp-st-variable-box vp-grid-box">
21+
</div>
22+
<div>
23+
<button id="addVariable" class="vp-button">+ Variable</button>
24+
<button id="removeVariable" class="vp-button">- Variable</button>
25+
</div>
26+
<div class="vp-st-option levene fligner vp-grid-col-160">
27+
<label for="center" class="vp-orange-text">Center</label>
28+
<select id="center" class="vp-select vp-state">
29+
<option value="mean">mean</option>
30+
<option value="median" selected>median</option>
31+
<option value="trimmed">trimmed</option>
32+
</select>
33+
</div>
34+
</div>
35+
</div>
36+
<div class="vp-grid-border-box">
37+
<label for="histogram">Display</label>
38+
<div class="vp-grid-box">
39+
<label><input type="checkbox" id="histogram" class="vp-state"><span>Histogram</span></label>
40+
</div>
41+
</div>
42+
</div>
43+
</body>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<!--
2+
Project Name : Visual Python
3+
Description : GUI-based Python code generator
4+
File Name : normTest.html
5+
Author : Black Logic
6+
Note : normality test
7+
License : GNU GPLv3 with Visual Python special exception
8+
Date : 2023. 05. 16
9+
Change Date :
10+
-->
11+
<body>
12+
<div class="vp-grid-box">
13+
<select id="testType" class="vp-big-select vp-state">
14+
<option value="shapiro-wilk">Shapiro-Wilk test</option>
15+
<option value="anderson-darling">Anderson-Darling test</option>
16+
<option value="kolmogorov-smirnov">Kolmogorov-Smirnov test</option>
17+
<option value="dagostino-pearson">D'Agostino and Pearson's test</option>
18+
<option value="jarque-bera">Jarque-Bera test</option>
19+
</select>
20+
<div class="vp-grid-border-box">
21+
<div class="vp-grid-box vp-st-option-box">
22+
<div class="vp-grid-col-160">
23+
<label for="var0" class="vp-orange-text">Variable</label>
24+
<div class="vp-flex-gap5">
25+
<input type="text" id="var0" class="vp-state vp-input"/>
26+
</div>
27+
</div>
28+
<div class="vp-st-option kolmogorov-smirnov vp-grid-col-160">
29+
<label for="alterHypo" class="vp-orange-text">Alternative hypothesis</label>
30+
<select id="alterHypo" class="vp-select vp-state">
31+
<option value="two-sided" selected>two-sided</option>
32+
<option value="less">less</option>
33+
<option value="greater">greater</option>
34+
</select>
35+
</div>
36+
</div>
37+
</div>
38+
<div class="vp-grid-border-box">
39+
<label for="histogram">Display</label>
40+
<div class="vp-grid-box">
41+
<label><input type="checkbox" id="histogram" class="vp-state"><span>Histogram</span></label>
42+
<label><input type="checkbox" id="boxplot" class="vp-state"><span>Boxplot</span></label>
43+
<label><input type="checkbox" id="qqplot" class="vp-state" checked><span>Q-Q Plot</span></label>
44+
</div>
45+
</div>
46+
</div>
47+
</body>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!--
2+
Project Name : Visual Python
3+
Description : GUI-based Python code generator
4+
File Name : propDist.html
5+
Author : Black Logic
6+
Note : probability distribution
7+
License : GNU GPLv3 with Visual Python special exception
8+
Date : 2023. 05. 16
9+
Change Date :
10+
-->
11+
<body>
12+
<div class="vp-grid-box">
13+
<div class="vp-grid-border-box">
14+
<div class="vp-grid-col-160">
15+
<label for="distType" class="vp-orange-text">Probability distribution</label>
16+
<select id="distType" class="vp-select vp-state">
17+
</select>
18+
</div>
19+
<div class="vp-pd-dist-option-box vp-grid-col-160">
20+
21+
</div>
22+
<div class="vp-grid-col-160">
23+
<label for="allocateTo" class="vp-orange-text">Allocate to</label>
24+
<input type="text" class="vp-input vp-state" id="allocateTo" placeholder="_res" />
25+
</div>
26+
</div>
27+
<div class="vp-grid-border-box">
28+
<label for="probMassFunc">Display</label>
29+
<div class="vp-grid-box">
30+
<label class="vp-pd-display-option dist cont"><input type="checkbox" id="probMassFunc" class="vp-state"><span>Probability mass function</span></label>
31+
<label class="vp-pd-display-option cont"><input type="checkbox" id="cumDistFunc" class="vp-state"><span>Cumulative distribution function</span></label>
32+
<label class="vp-pd-display-option dist cont"><input type="checkbox" id="sampledDist" class="vp-state" checked><span>Sampled distribution</span></label>
33+
</div>
34+
</div>
35+
</div>
36+
</body>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<!--
2+
Project Name : Visual Python
3+
Description : GUI-based Python code generator
4+
File Name : studentstTest.html
5+
Author : Black Logic
6+
Note : student's t-test
7+
License : GNU GPLv3 with Visual Python special exception
8+
Date : 2023. 05. 16
9+
Change Date :
10+
-->
11+
<body>
12+
<div class="vp-grid-box">
13+
<select id="testType" class="vp-big-select vp-state">
14+
<option value="one-sample">One-sample t-test</option>
15+
<option value="two-sample">Independent two-sample t-test</option>
16+
<option value="paired-sample">Paired samples t-test</option>
17+
</select>
18+
<div class="vp-grid-border-box">
19+
<div class="vp-grid-box vp-st-option-box">
20+
<div class="vp-st-option one-sample vp-grid-box">
21+
<div class="vp-grid-col-160">
22+
<label for="var0" class="vp-orange-text">Variable</label>
23+
<div class="vp-flex-gap5">
24+
<input type="text" id="var0" class="vp-state vp-input"/>
25+
</div>
26+
<label for="testValue" class="vp-orange-text">Test value</label>
27+
<input type="number" id="testValue" class="vp-state vp-input"/>
28+
</div>
29+
<div>
30+
<label class="vp-orange-text vp-italic">NOTE:</label><label class="vp-gray-text vp-italic">Expected value in null hypothesis</label>
31+
</div>
32+
</div>
33+
<div class="vp-st-option two-sample paired-sample vp-grid-col-160">
34+
<label for="var1" class="vp-orange-text">Variable 1</label>
35+
<div class="vp-flex-gap5">
36+
<input type="text" id="var1" class="vp-state vp-input"/>
37+
</div>
38+
<label for="var2" class="vp-orange-text">Variable 2</label>
39+
<div class="vp-flex-gap5">
40+
<input type="text" id="var2" class="vp-state vp-input"/>
41+
</div>
42+
</div>
43+
<div class="vp-st-option one-sample two-sample paired-sample vp-grid-col-160">
44+
<label for="alterHypo" class="vp-orange-text">Alternative hypothesis</label>
45+
<select id="alterHypo" class="vp-select vp-state">
46+
<option value="two-sided" selected>two-sided</option>
47+
<option value="less">less</option>
48+
<option value="greater">greater</option>
49+
</select>
50+
</div>
51+
<div class="vp-st-option one-sample paired-sample vp-grid-col-160">
52+
<label for="confInt" class="vp-orange-text">Confidence interval</label>
53+
<div>
54+
<input type="number" id="confInt" class="vp-state vp-input" value="95"/> %
55+
</div>
56+
</div>
57+
</div>
58+
</div>
59+
</div>
60+
</body>

0 commit comments

Comments
 (0)