@@ -60,6 +60,8 @@ define([
6060
6161this . columnBindList = [ 'depVar' , 'factor' , 'factorA' , 'factorB' , 'covariate' ] ;
6262
63+ this . tmpInstallCode = [ ] ; // install codes
64+
6365this . 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+ } else if ( 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([
91116com_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+ let id = $ ( this ) [ 0 ] . id ;
122+ let checked = $ ( 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
96143templateForBody ( ) {
@@ -147,6 +194,10 @@ define([
147194$ ( this . wrapSelector ( '.vp-st-option.' + this . state . testType ) ) . show ( ) ;
148195}
149196
197+ generateInstallCode ( ) {
198+ return this . tmpInstallCode ;
199+ }
200+
150201generateCode ( ) {
151202let {
152203 testType, data, depVar, factor, factorA, factorB, covariate, sigLevel,
@@ -253,12 +304,6 @@ define([
253304}
254305
255306if ( 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
263308if ( tukey === true ) {
264309code . appendLine ( ) ;
@@ -383,13 +428,6 @@ define([
383428code . append ( "display(_res[0])" ) ;
384429}
385430if ( 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
394432if ( tukey === true ) {
395433code . appendLine ( ) ;
@@ -453,13 +491,6 @@ define([
453491code . 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-
463494code . appendLine ( ) ;
464495code . appendLine ( ) ;
465496code . appendLine ( "# ANCOVA - Analysis of covariance" ) ;