Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcc09c3f

Browse files
author
minjk-bl
committed
Edit ANOVA to show install button instead of force-insert install codes
1 parent0796673 commitcc09c3f

File tree

2 files changed

+53
-22
lines changed

2 files changed

+53
-22
lines changed

‎visualpython/html/m_stats/anova.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
<divclass="vp-st-option one-way two-way vp-grid-col-130">
5151
<labelfor="sigLevel"class="vp-orange-text">Significance level</label>
5252
<inputtype="number"id="sigLevel"class="vp-state vp-input"required/>
53-
<labelfor="covariate"class="vp-orange-text">Post hoc analysis</label>
54-
<divclass="vp-grid-col-rp3">
53+
<labelfor="tukeyHSD"class="vp-orange-text">Post hoc analysis</label>
54+
<divclass="vp-grid-col-rp3 vp-st-posthoc-box">
5555
<label><inputtype="checkbox"id="tukeyHSD"class="vp-state"checked><span>Tukey HSD</span></label>
5656
<label><inputtype="checkbox"id="tukey"class="vp-state"><span>Tukey</span></label>
5757
<span></span>

‎visualpython/js/m_stats/Anova.js‎

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ define([
6060

6161
this.columnBindList=['depVar','factor','factorA','factorB','covariate'];
6262

63+
this.tmpInstallCode=[];// install codes
64+
6365
this.subsetEditor={};
6466
}
6567

@@ -74,6 +76,29 @@ define([
7476

7577
$(that.wrapSelector('.vp-st-option')).hide();
7678
$(that.wrapSelector('.vp-st-option.'+testType)).show();
79+
80+
that.tmpInstallCode=[];
81+
that.hideInstallButton();
82+
83+
if(testType==='one-way'||testType==='two-way'){
84+
if(that.state.tukey||that.state.scheffe||that.state.duncan){
85+
// Add installation code
86+
if(vpConfig.extensionType==='lite'){
87+
that.tmpInstallCode=["%pip install scikit-posthocs"];
88+
}else{
89+
that.tmpInstallCode=["!pip install scikit-posthocs"];
90+
}
91+
that.showInstallButton();
92+
}
93+
}elseif(testType==='ancova'){
94+
// Add installation code : # pip install pingouin
95+
if(vpConfig.extensionType==='lite'){
96+
that.tmpInstallCode=["%pip install pingouin"];
97+
}else{
98+
that.tmpInstallCode=["!pip install pingouin"];
99+
}
100+
that.showInstallButton();
101+
}
77102
});
78103

79104
$(this.wrapSelector('#data')).on('change',function(){
@@ -91,6 +116,28 @@ define([
91116
com_generator.vp_bindColumnSource(that,'data',that.columnBindList,'select',false,false);
92117
}
93118
});
119+
120+
$(this.wrapSelector('.vp-st-posthoc-box .vp-state')).on('change',function(){
121+
letid=$(this)[0].id;
122+
letchecked=$(this).prop('checked')===true;
123+
that.state[id]=checked;
124+
let{ testType, tukey, scheffe, duncan}=that.state;
125+
if(testType==='one-way'||testType==='two-way'){
126+
if(tukey||scheffe||duncan){
127+
// Add installation code
128+
if(vpConfig.extensionType==='lite'){
129+
that.tmpInstallCode=["%pip install scikit-posthocs"];
130+
}else{
131+
that.tmpInstallCode=["!pip install scikit-posthocs"];
132+
}
133+
that.showInstallButton();
134+
}else{
135+
that.hideInstallButton();
136+
}
137+
}
138+
});
139+
140+
$(this.wrapSelector(''))
94141
}
95142

96143
templateForBody(){
@@ -147,6 +194,10 @@ define([
147194
$(this.wrapSelector('.vp-st-option.'+this.state.testType)).show();
148195
}
149196

197+
generateInstallCode(){
198+
returnthis.tmpInstallCode;
199+
}
200+
150201
generateCode(){
151202
let{
152203
testType, data, depVar, factor, factorA, factorB, covariate, sigLevel,
@@ -253,12 +304,6 @@ define([
253304
}
254305

255306
if(tukey===true||scheffe===true||duncan===true){
256-
if(vpConfig.extensionType==='lite'){
257-
codeList.push("%pip install scikit-posthocs");
258-
}else{
259-
codeList.push("!pip install scikit-posthocs");
260-
}
261-
262307
// Post hoc analysis - Tukey
263308
if(tukey===true){
264309
code.appendLine();
@@ -383,13 +428,6 @@ define([
383428
code.append("display(_res[0])");
384429
}
385430
if(tukey===true||scheffe===true||duncan===true){
386-
// Add installation code
387-
if(vpConfig.extensionType==='lite'){
388-
codeList.push("%pip install scikit-posthocs");
389-
}else{
390-
codeList.push("!pip install scikit-posthocs");
391-
}
392-
393431
// Post hoc analysis - Tukey
394432
if(tukey===true){
395433
code.appendLine();
@@ -453,13 +491,6 @@ define([
453491
code.append(" plt.show()");
454492
}
455493

456-
// Add installation code : # pip install pingouin
457-
if(vpConfig.extensionType==='lite'){
458-
codeList.push("%pip install pingouin");
459-
}else{
460-
codeList.push("!pip install pingouin");
461-
}
462-
463494
code.appendLine();
464495
code.appendLine();
465496
code.appendLine("# ANCOVA - Analysis of covariance");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp