painel 05 02 - remis balaniuk - modelo bayesiano de analise de risco de conluio ug fornecedor

47
Modelo probabilístico de cálculo de risco na relação entre UG e fornecedor Secretaria de Gestão de Informações para o Controle Externo – Seginf TCU Setembro/2015 Remis Balaniuk,PhD Especialista Sênior

Upload: tribunal-de-contas-da-uniao-tcu-oficial

Post on 10-Jan-2017

312 views

Category:

Technology


0 download

TRANSCRIPT

Slide 1

Modelo probabilstico de clculo de risco na relao entre UG e fornecedorSecretaria de Gesto de Informaes para o Controle Externo SeginfTCUSetembro/2015

Remis Balaniuk,PhDEspecialista Snior

1

Analytics no contexto do ControleModelos prescritivos ou descritivos?Modelos prescritivos Auditor vai no objeto indicado pela mineraoRequerem preciso Chegar perto no um bom resultadoFalsos positivos quebram a confiana no processoModelos caixa preta no explicam resultados obtidosAuditor pode no se sentir confortvel em ser pautado Modelos descritivosApresentar um recorte qualitativo dos dados enriquecidos com indicadores Auditor utiliza seu conhecimento de negcio e sua intuio para selecionar dentro do recorte objetos de forma orientada pelo modelo

Analytics no contexto do ControlePoucas bases de exemplosDada a multitude de critrios e variveis a considerarDada a necessidade de grande nmero de exemplos positivos e negativosMuitos dados estruturadosGrandes bases de dados da administrao pblica (AP)Conhecimento de negcio abundanteConhecimento tcito dos auditores sobre prticas e riscos na APTipologias de prticas ilcitasPerfil e comportamento tpico dos atores Normas, legado de processos e decises

3

Analytics no contexto do ControleContexto favorvel para a aplicao de tcnicas hbridasDados + conhecimento a priori = construo de modelos preditivosModelos + descoberta de conhecimento = ambiente de anlise e planejamento de auditorias

Analytics no contexto do ControleProblema tpico do auditor:Dado um grande conjunto de instncias dentro de um temaObjetos de controleContratos, fornecedores, pessoas, rgos, etcEscolher o que auditarDuas grandes classes:A: Objeto vale a pena auditarB: Objeto no vale a pena auditarMultitude de critrios a considerar:Materialidade, oportunidade, viabilidade, indcios

Analytics no contexto do ControleProblema tpico do auditor:Classe A muito menor que classe BPor limitaes de recursos Por suposio de que comportamentos irregulares sejam exceoProblema de classificao?Problema de ranqueamento?

Analytics no contexto do ControleMeta-problema:Dado um conjunto de objetos de controle, calcular um indicador principal que permita ranquea-lo segundo a significncia de audita-loChamaremos esse indicador de RiscoPor falta de um nome melhor...

Analytics no contexto do ControleRisco: condio que aumenta ou diminui o potencial de perdasA anlise de riscos estruturada possui dois parmetros claros a serem estudados:PRIMEIRO: saber qual a chance, a probabilidade, dos problemas virem a acontecer, frente condio existente riscoSEGUNDO: calcular o impacto seja ele operacional como financeiroPerda Esperada:Multiplicao direta entre a probabilidade do risco vir a acontecer versus seu impacto financeiro.

Analytics no contexto do ControleAvaliao de riscos quantitativa ObjetivaTenta calcular valores numricos objetivos para cada uma das instncias do conjunto alvo

Analytics no contexto do ControleTransformando a anlise de risco num problema de minerao de dados:Deseja-se um modelo preditivoInferncia indutiva ou dedutiva?Modelos a partir de dados?Bases abundantes No possvel contar com bases de exemplos significativasModelos a partir de premissas?Conhecimento de negcio abundantePoucas premissas absolutamente certas

Raciocnio BayesianoUm framework para explicar a cognio. Como aprender a partir de dados limitados e com errosModelos qualitativos robustos a partir de mnimos pressupostos ad hoc

Um framework para entender como conhecimento estruturado interage com inferncia estatstica

11

Teorema de BayesExemplo:H=paciente tem meningiteD=paciente tem rigidez cervicalMeningite causa rigidez cervical em 50% dos casosP(D|H)=0,5Probabilidade de algum ter meningite 1/50000P(H)=1/50000Probabilidade de rigidez cervical 1/20P(D)=1/20Se um paciente tem rigidez cervical qual a probabilidade de ter meningite:P(H|D)=(0,5*1/50000)/(1/20)=0,0002

Para uma hiptese H e um dado D :

Classificador BayesianoNa prtica:A hiptese H pode ser interpretada como uma classe (C)Varivel aleatria cujos valores correspondem s classes possveisO dado D pode ser interpretado como um vetor de atributos, sendo cada um uma varivel aleatria (D1, D2,..., Dn)O objetivo poder calcular a probabilidade posterior de cada classe para cada instncia de DP(C|D1, D2,..., Dn)Mas para isso preciso antes calcular P(D1, D2,..., Dn|C)O que pode ser invivel para um n elevado ou se C e Dn podem assumir muitos valores diferentes

Nave BayesSimplifica enormemente o problema ao assumir que os atributos Dn so INDEPENDENTESNesse caso: P(D1, D2,..., Dn|C)= P(D1|C) P(D2|C)... P(Dn|C)Basta calcular P(Di|Ck) para todos Di e Ck

Voltando ao problema do auditorConsideraremos nossas classes como: Objetos a serem auditados = CAObjetos que no sero auditados = CBP(CA)+P(CB)=1Permite ordenar objetos de controle por risco (P(CA))Os atributos Di podem ser escolhidos pelo auditor segundo seu conhecimento de negcio e o tipo de objeto de controle a ser classificadoMas clculo de P(Di|Ck) ainda requer uma base de exemplos...

Voltando ao problema do auditorAssumiremos mais uma hiptese simplificadora:Dado que os conjunto de objetos a serem auditados muito menor do que os que no o sero | CA |80%

Modelos especficosPor isso foram processados quatro modelos distintos:ObrasServios Bens e materiaisGeral

Valores em riscoO modelo probabilstico calcula um fator de risco para cada par UG+FornecedorA materialidade do risco foi obtida multiplicando esse fator pelo total dos valores pagos pela UG ao fornecedor possvel totalizar a materialidade do risco por UG somente ou por fornecedor somenteDessa forma possvel ordenar pares, UGs e/ou fornecedores por risco e por materialidade

Resultados Dos 897.303 pares iniciais 5.338 foram considerados de riscoRisco acima de 50% em pelo menos um dos modelosValores em risco Totalizando mais de R$66 bilhes

Elaborado painel de visualizao (Qlikview)Permite que o auditor explore o modelo Resultados

FOC em andamento usando o modeloCoordenao: SelogRS, SC, PR, SP, RJ, BA, CE, PA, MT e GO

Aplicao

PublicaoInternational Journal of Reasoning-based Intelligent Systems

Print ISSN: 1755-0556 Online ISSN: 1755-0564

Dvidas?

Graph60.89650186490.06087741950.02872022180.01192543250.00166618880.00025226640.0000455310.0000110751

P(NREFOR)valueProbability table

R_PTSESOCUF1Value of TSESOP(TSESO)00.950.9510.051

PTSESOCUF1VariablesConditionalsvaluesParametric formDistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 2TSESOHistogramValue of TSESOP(TSESO)00.9510.05

PTSESOCUF10.950.05

P(TSESO)valueProbability table

R_PTSESOCUF0Value of TSESOP(TSESO)00.9999913860.99999138610.0000086141

PTSESOCUF0VariablesConditionalsvaluesParametric formProbability values.......DistributionFileC:\Users\Remis\Probayes\comprasnet\proBT data\tseso.txtUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 2TSESOHistogram

PTSESOCUF00.9999913860.000008614

P(TSESO)valueProbability table

R_PTEMCCUF1Value of TEMCP(TEMC)00.020.0210.10.1220.160.2830.180.4640.180.6450.180.8260.181

PTEMCCUF1VariablesConditionalsvaluesParametric formDistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 2TEMCHistogramValue of TEMCP(TEMC)00.0210.120.1630.1840.1850.1860.18

PTEMCCUF10.020.10.160.180.180.180.18

P(TEMC)valueProbability table

R_PTEMCCUF0Value of TEMCP(TEMC)00.78634020520.786340205210.18889830960.975238514820.01685877880.992097293630.00627958750.998376881140.00144714770.999824028850.00017227950.999996308360.00000369171

PTEMCCUF0VariablesConditionalsvaluesParametric formProbability values.......DistributionFileC:\Users\Remis\Probayes\comprasnet\proBT data\temc.txtUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 2TEMCHistogram

PTEMCCUF00.78634020520.18889830960.01685877880.00627958750.00144714770.00017227950.0000036917

P(TEMC)valueProbability table

R_PNEMCCUF1Value of NEMCP(NEMC)00.0190476190.01904761910.05714285710.076190476220.09523809520.171428571430.14285714290.314285714340.17142857140.485714285750.17142857140.657142857160.17142857140.828571428670.17142857141

PNEMCCUF1VariablesConditionalsvaluesParametric formDistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 2NEMCHistogramValue of NEMCP(NEMC)00.0210.0620.130.1540.1850.1860.1870.18

PNEMCCUF10.0190476190.05714285710.09523809520.14285714290.17142857140.17142857140.17142857140.1714285714

P(NEMC)valueProbability table

R_PNEMCCUF0Value of NEMCP(NEMC)00.78634020520.786340205210.17025028520.956590490420.03286477410.989455264630.00861028290.998065547440.00174494510.999810492650.00016735720.999977849860.00002091970.999998769470.00000123061

PNEMCCUF0VariablesConditionalsvaluesParametric formProbability values.......DistributionFileC:\Users\Remis\Probayes\comprasnet\proBT data\nemc.txtUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 2NEMCHistogram

PNEMCCUF00.78634020520.17025028520.03286477410.00861028290.00174494510.00016735720.00002091970.0000012306

P(NEMC)valueProbability table

R_PTANULACUF1Value of TANULAP(TANULA)00.90.910.040.9420.020.9630.010.9740.010.9850.010.9960.011

PTANULACUF1VariablesConditionalsvaluesParametric formDistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 2TANULAHistogramValue of TANULAP(TANULA)00.910.0420.0230.0140.0150.0160.01

PTANULACUF10.90.040.020.010.010.010.01

P(TANULA)valueProbability table

R_PTANULACUF0Value of TANULAP(TANULA)00.73682584880.736825848810.20368358160.940509430520.04460562150.985115051930.01228475830.997399810240.00227285870.99967266950.00031994760.999992616660.00000738341

PTANULACUF0VariablesConditionalsvaluesParametric formProbability values.......DistributionFileC:\Users\Remis\Probayes\comprasnet\proBT data\tanula.txtUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 3TANULAHistogram

PTANULACUF00.73682584880.20368358160.04460562150.01228475830.00227285870.00031994760.0000073834

P(TANULA)valueProbability table

R_PNANULACUF1Value of NANULAP(NANULA)00.90.910.040.9420.010.9530.010.9640.010.9750.010.9860.010.9970.011

PNANULACUF1VariablesConditionalsvaluesParametric formDistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 3NANULAHistogramValue of NANULAP(NANULA)00.910.0420.0130.0140.0150.0160.0170.01

PNANULACUF10.90.040.010.010.010.010.010.01

P(NANULA)valueProbability table

R_PNANULACUF0Value of NANULAP(NANULA)00.73682584880.736825848810.19366675980.930492608620.05189550510.982388113730.01441733230.99680544640.00268632950.999491775550.00042577650.99991755260.00006768120.999985233270.00001476681

PNANULACUF0VariablesConditionalsvaluesParametric formProbability values.......DistributionFileC:\Users\Remis\Probayes\comprasnet\proBT data\nanula.txtUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 2NANULAHistogram

PNANULACUF00.73682584880.19366675980.05189550510.01441733230.00268632950.00042577650.00006768120.0000147668

P(NANULA)valueProbability table

R_PTREFORCUF1Value of TREFORP(TREFOR)00.020.0210.10.1220.160.2830.180.4640.180.6450.180.8260.181

PTREFORCUF1VariablesConditionalsvaluesParametric formDistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 2TREFORHistogramValue of TREFORP(TREFOR)00.0210.120.1630.1840.1850.1860.18

PTREFORCUF10.020.10.160.180.180.180.18

P(TREFOR)valueProbability table

R_PTREFORCUF0Value of TREFORP(TREFOR)00.89650186490.896501864910.05430126510.950803130120.02887281220.979675942330.01570573680.995381679140.00405841260.999440091750.00054268040.999982772160.00001722791

PTREFORCUF0VariablesConditionalsvaluesParametric formProbability values.......DistributionFileC:\Users\Remis\Probayes\comprasnet\proBT data\trefor.txtUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 2TREFORHistogram

PTREFORCUF00.89650186490.05430126510.02887281220.01570573680.00405841260.00054268040.0000172279

P(TREFOR)valueProbability table

R_PTISLICITCUF1Value of TISLICITP(TISLICIT)00.020.0210.140.1620.210.3730.210.5840.210.7950.211

PTISLICITCUF1VariablesConditionalsvaluesParametric formDistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 4TISLICITHistogramValue of TISLICITP(TISLICIT)00.0210.1420.2130.2140.2150.21

PTISLICITCUF10.020.140.210.210.210.21

P(TISLICIT)valueProbability table

Question1_ResultValue of CUFP(CUF)00.99999997350.999999973510.00000002651

Question1Searched VariablesKnown VariablesValuesValues..QuestionDescription1ExactNoneCompileQuestion1_ResultExactGraphique 5CUFNISLICIT5TISLICIT1NREFOR0TREFOR0NANULA2TANULA1NEMC1TEMC1TSESO0

Use column C,D, to test the inference on a set of values for the known variablesColumn B contains the list of known variablesColumn A contains the list of searched variables

Question10.99999997350.0000000265

P(CUF)valueProbability table

R_PTISLICITCUF0Value of TISLICITP(TISLICIT)00.22655614530.226556145310.75542834220.981984487520.01648099450.99846548230.00136593030.999831412240.00015874320.999990155550.00000984451

PTISLICITCUF0VariablesConditionalsvaluesParametric formProbability values.......DistributionFileC:\Users\Remis\Probayes\comprasnet\proBT data\tislicit.txtUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 5TISLICITHistogram

PTISLICITCUF00.22655614530.75542834220.01648099450.00136593030.00015874320.0000098445

P(TISLICIT)valueProbability table

P(TISLICIT|CUF)VariablesConditionalsvaluesParametric formKey Variable oneKey Variable two.......DistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseTISLICITCUFBayesian-caseCUFDistributionCUFPTISLICITCUF00PTISLICITCUF11

R_NREFORCUF1Value of NREFORP(NREFOR)00.020.0210.030.0520.050.130.070.1740.090.2650.110.3760.130.570.150.6580.170.8290.181

R_PNREFORCUF1Value of NREFORP(NREFOR)00.0190476190.01904761910.05714285710.076190476220.09523809520.171428571430.14285714290.314285714340.17142857140.485714285750.17142857140.657142857160.17142857140.828571428670.17142857141

PNREFORCUF1VariablesConditionalsvaluesParametric formDistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 3NREFORHistogramValue of NREFORP(NREFOR)00.0210.0620.130.1540.1850.1860.1870.18

PNREFORCUF10.0190476190.05714285710.09523809520.14285714290.17142857140.17142857140.17142857140.1714285714

P(NREFOR)valueProbability table

R_PNREFORCUF0Value of NREFORP(NREFOR)00.89650186490.896501864910.06087741950.957379284420.02872022180.986099506230.01192543250.998024938740.00166618880.999691127550.00025226640.999943393960.0000455310.999988924970.00001107511

PNREFORCUF0VariablesConditionalsvaluesParametric formDistributionFileC:\Users\Remis\Probayes\comprasnet\proBT data\nrefor.txtUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 2NREFORHistogram

PNREFORCUF00.89650186490.06087741950.02872022180.01192543250.00166618880.00025226640.0000455310.0000110751

P(NREFOR)valueProbability table

R_PNISLICITCUF1Value of NISLICITP(NISLICIT)00.040.0410.060.120.080.1830.090.2740.110.3850.120.560.120.6270.120.7480.130.8790.131

PNISLICITCUF1VariablesConditionalsvaluesParametric formDistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 5NISLICITHistogramValue of NISLICITP(NISLICIT)00.0410.0620.0830.0940.1150.1260.1270.1280.1390.13

PNISLICITCUF10.040.060.080.090.110.120.120.120.130.13

P(NISLICIT)valueProbability table

R_PNISLICITCUF0Value of NISLICITP(NISLICIT)00.20083850890.200838508910.41832783060.619166339520.18318232220.802348661730.1037147150.906063376740.05518604340.961249420150.02566841370.986917833860.00973379130.99665162570.00287460640.999526231480.00044177380.999968005290.00003199481

PNISLICITCUF0VariablesConditionalsvaluesParametric formProbability values.......DistributionFileC:\Users\Remis\Probayes\comprasnet\proBT data\nislicit.txtUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseGraphique 4NISLICITHistogram

PNISLICITCUF00.20083850890.41832783060.18318232220.1037147150.05518604340.02566841370.00973379130.00287460640.00044177380.0000319948

P(NISLICIT)valueProbability table

P(TSESO|CUF)VariablesConditionalsvaluesParametric formKey Variable oneKey Variable two.......DistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseTSESOCUFBayesian-caseCUFDistributionCUFPTSESOCUF00PTSESOCUF11

P(TEMC|CUF)VariablesConditionalsvaluesParametric formKey Variable oneKey Variable two.......DistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseTEMCCUFBayesian-caseCUFDistributionCUFPTEMCCUF00PTEMCCUF11

P(NEMC|CUF)VariablesConditionalsvaluesParametric formKey Variable oneKey Variable two.......DistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseNEMCCUFBayesian-caseCUFDistributionCUFPNEMCCUF00PNEMCCUF11

P(TANULA|CUF)VariablesConditionalsvaluesParametric formKey Variable oneKey Variable two.......DistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseTANULACUFBayesian-caseCUFDistributionCUFPTANULACUF00PTANULACUF11

P(NANULA|CUF)VariablesConditionalsvaluesParametric formKey Variable oneKey Variable two.......DistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseNANULACUFBayesian-caseCUFDistributionCUFPNANULACUF00PNANULACUF11

P(TREFOR|CUF)VariablesConditionalsvaluesParametric formKey Variable oneKey Variable two.......DistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseTREFORCUFBayesian-caseCUFDistributionCUFPTREFORCUF00PTREFORCUF11

P(NREFOR|CUF)VariablesConditionalsvaluesParametric formKey Variable oneKey Variable two.......DistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseNREFORCUFBayesian-caseCUFDistributionCUFPNREFORCUF00PNREFORCUF11

P(NISLICIT|CUF)VariablesConditionalsvaluesParametric formKey Variable oneKey Variable two.......DistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseNISLICITCUFBayesian-caseCUFDistributionCUFPNISLICITCUF00PNISLICITCUF11

P(CUF)VariablesConditionalsvaluesParametric formDistributionNoneUnknownUniformHistogramNormalLognormalDiracPoissonBayesian-caseCUFHistogramValue of CUFP(CUF)00.9910.01

VariablesVariable NamesVariable typesMin ValueMax ValueNb ValuesCommentsparametersProBT-XL 0.1VariablesIntegerRealSparseIntervalLabel0CUFInteger01conluio unidade x fornecedor (1 - existe 0 - no existe)NISLICITInteger09numero de itens de compra sem licitaoTISLICITInteger05total dos itens de compra sem licitaoNREFORInteger07numero de reforos de empenhoTREFORInteger06total dos reforos de empenhoNANULAInteger07numero de anulaes de empenhoTANULAInteger06total das anulaes de empenhoNEMCInteger07numero de empenhos maiores que as comprasTEMCInteger06total dos empenhos maiores que as comprasTSESOInteger01tem servidor socio da empresa

Column A contains the identifier for each variable used : each identifier should be uniqueDefines the type for each variables : Integer, Real, Sparse, Interval and LabelMinimum Value for Integer and RealMaximum Value for Integer and RealNB ValuesFor Real : number of bins used to discretize the Real Note : This field may remain empty if approximate inference is used and if it is not necessary to draw the distribution.Insert a commentStarting column to enter Labels, Sparse values and Interval Limits

Description1DecompositionDescriptionVariablesP(CUF)P(NISLICIT|CUF)P(NREFOR|CUF)P(TREFOR|CUF)P(NANULA|CUF)P(TANULA|CUF)P(NEMC|CUF)P(TEMC|CUF)P(TSESO|CUF)P(TISLICIT|CUF)

Column A contains the list of distributions (referenced by the name of the worksheet where they are defined). This list defines the joint distribution.CUFNISLICITNREFORTREFORNANULATANULANEMCTEMCTSESOTISLICIT

Feuil1

Feuil2

Feuil3

Attribute VB_Name = "Feuil2"Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = TrueAttribute VB_TemplateDerived = FalseAttribute VB_Customizable = True

Attribute VB_Name = "Feuil1"Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = TrueAttribute VB_TemplateDerived = FalseAttribute VB_Customizable = True

Attribute VB_Name = "Feuil4"Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = TrueAttribute VB_TemplateDerived = FalseAttribute VB_Customizable = True

Attribute VB_Name = "Feuil3"Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = TrueAttribute VB_TemplateDerived = FalseAttribute VB_Customizable = True

Sub Worksheet_Activate()

Application.Run "MenuProbt.switch"Application.Run "Description.Model_Buttons_Panel"

Dim Menu_Contextuel As CommandBar Dim NewBtn As CommandBarComboBox Dim NewBtn2 As CommandBarControl Set Menu_Contextuel = Application.CommandBars("Shapes") Nombre_Controles = Menu_Contextuel.Controls.Count For i = 1 To Nombre_Controles Menu_Contextuel.Controls.Item(1).Delete Next i Nombre_Controles = Menu_Contextuel.Controls.Count Set NewBtn2 = Menu_Contextuel.Controls.Add(Type:=msoControlButton, before:=1) With NewBtn2 .Caption = "Goto Variables" .BeginGroup = True .OnAction = "go_to_variables" End With Set NewBtn2 = Menu_Contextuel.Controls.Add(Type:=msoControlButton, before:=2) With NewBtn2 .Caption = "Goto Distribution" .BeginGroup = True .OnAction = "go_to_distribution" End With End Sub

Sub Worksheet_Deactivate() On Error Resume Next Application.CommandBars("Description").Visible = FalseEnd Sub

Attribute VB_Name = "Feuil6"Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = TrueAttribute VB_TemplateDerived = FalseAttribute VB_Customizable = TrueSub Worksheet_Activate()Application.Run "MenuProbt.switch"Application.Run "Variables.Variables_Buttons_Panel"End SubSub Worksheet_Deactivate() On Error Resume Next Application.CommandBars("Variables").Visible = FalseEnd SubSub Worksheet_Change(ByVal Target As Range)If TouchingVariables Then GoTo fin 'touching model can be set by the model sheet Select Case Target.Column Case 2 ' modification du type ligne = Target.Row ActiveSheet.Unprotect Range(Cells(ligne, 2), Cells(ligne, 7)).Locked = False

Select Case Target.value Case "Integer" Range(Cells(ligne, 3), Cells(ligne, 7)).Interior.ColorIndex = 0 Cells(ligne, 5).Locked = True Range(Cells(ligne, 3), Cells(ligne, 4)).Interior.ColorIndex = 35 Case "Real" Range(Cells(ligne, 3), Cells(ligne, 7)).Interior.ColorIndex = 0 Range(Cells(ligne, 3), Cells(ligne, 5)).Interior.ColorIndex = 35 Case "Label" Range(Cells(ligne, 3), Cells(ligne, 7)).Interior.ColorIndex = 0 Range(Cells(ligne, 3), Cells(ligne, 4)).Locked = True 'Cells(ligne, 5).Interior.ColorIndex = 35 Cells(ligne, 7).Interior.ColorIndex = 35 Case "Sparse" Range(Cells(ligne, 3), Cells(ligne, 7)).Interior.ColorIndex = 0 Range(Cells(ligne, 3), Cells(ligne, 4)).Locked = True 'Cells(ligne, 5).Interior.ColorIndex = 35 Cells(ligne, 7).Interior.ColorIndex = 35 Case "Interval" Range(Cells(ligne, 3), Cells(ligne, 7)).Interior.ColorIndex = 0 Range(Cells(ligne, 3), Cells(ligne, 4)).Locked = True 'Cells(ligne, 5).Interior.ColorIndex = 35 Cells(ligne, 7).Interior.ColorIndex = 35 Case Else ' Autres valeurs. Range(Cells(ligne, 3), Cells(ligne, 7)).Interior.ColorIndex = 0 End Select Case Else ' on veut effacer les couleurs des cases remplies Dim used As Variant used = ActiveSheet.UsedRange Dim lastligne As Integer Dim lascolumn As Integer lastligne = UBound(used, 1) lastcolumn = UBound(used, 2) For i = 2 To lastligne For j = 1 To lastcolumn If Not IsEmpty(Cells(i, j)) Then Cells(i, j).Interior.ColorIndex = 0 Next j Next i End Select fin: 'ActiveSheet.ProtectEnd Sub

Attribute VB_Name = "Feuil5"Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = TrueAttribute VB_TemplateDerived = FalseAttribute VB_Customizable = True

Sub Worksheet_Activate()

'If ActiveSheet.name = "xxquestion" Then'GoTo fini'End If

' FeuillePrecedante = FeuilleActuelle ' FeuilleActuelle = ActiveSheet.name Application.Run "MenuProbt.switch"Application.Run "Question.Question_Buttons_Panel"fini:End SubSub Worksheet_Deactivate() On Error Resume Next Application.CommandBars("Question").Visible = False 'Application.CommandBars("Question").Reset

End Sub

Attribute VB_Name = "Feuil8"Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = TrueAttribute VB_TemplateDerived = FalseAttribute VB_Customizable = TrueSub Worksheet_Activate()Application.Run "MenuProbt.switch" Application.Run "Distribution.Distribution_Buttons_Panel"End SubSub Worksheet_Deactivate() On Error Resume Next Application.CommandBars("Distribution").Visible = FalseEnd SubSub Worksheet_Change(ByVal Target As Range) If Not (Target.Address = Range("F2").Address) Then GoTo fin Dim variablename As String variablename = Application.Run("Service.RemoveAllSpace", (Range("A2").value)) Range("G2", [G2].End(xlToRight)).Interior.ColorIndex = 0 Range("G2", [G2].End(xlToRight)).ClearContents 'Range("G2:J2").Interior.ColorIndex = 0 Range("G1:J1").Interior.ColorIndex = 0 Range("G1:J1").ClearContents 'If (lignecomptC() > 1) Then GoTo fin ' il y a des variables a droite

Select Case Target.value Case "Normal" Range("G1").FormulaR1C1 = "Mean" Range("H1").FormulaR1C1 = "Standard Deviation" Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Mean" .InputMessage = "Enter the mean of the distribution or a ProBT-formula " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Standard Deviation" .InputMessage = "Enter the Standard Deviation of the distribution or ProBT-formula " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Uniform"'TODO min max Dim minmaxpredicate As Long minmaxpredicate = Application.Run("ApiProbt.CCHasVariableAMinMax", variablename) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin If minmaxpredicate = 1 Then Range("G1").FormulaR1C1 = "[Min]" Range("H1").FormulaR1C1 = "[Max]" Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Min" .InputMessage = "Optionaly nnter the Min value or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Max" .InputMessage = "Optionaly enter the Max value or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 End If

Case "Histogram" ' dans ce cas on c'est forcement un new template : ne faut t-il pas le mettre ? If (Application.Run("Service.lignecomptC") > 1) Then GoTo fin

'TODO: histogram 1D Dim nbcases As Integer Range("G1").FormulaR1C1 = "Probability values" Range("H1").FormulaR1C1 = "......." Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With toto = Application.Run("ApiProbt.CCSelectFolder", ActiveWorkbook.name) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin nbcases = Application.Run("ApiProbt.CCGetVariableCardinality", variablename) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin For i = 1 To nbcases Cells(2, 6 + i).Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween '.InputTitle = "Probability Value or number of cases" '.InputMessage = "Enter a probability Value or the number of value in the histogram" '.ShowInput = True End With Selection.Interior.ColorIndex = 35 Next i Case "Dirac"'TODO: non-conditional dirac point Range("G1").FormulaR1C1 = "Value or function in c like format" Range("G1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Value or function" .InputMessage = "Enter a value or a function ex P(X|Y) : X=2*Y; " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Poisson"'TODO: non-conditional dirac point Range("G1").FormulaR1C1 = "Mean or ProBT-formula" Range("G1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Mean" .InputMessage = "Enter a value or a ProBT formula; " .ShowInput = True End With Selection.Interior.ColorIndex = 35

Case "Lognormal"

Range("G1").FormulaR1C1 = "Sigma" Range("H1").FormulaR1C1 = "Theta" Range("I1").FormulaR1C1 = "m" Range("G1:I1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Sigma" .InputMessage = "Enter the shape parameter or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Theta" .InputMessage = "Enter the location parameter or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("I2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "m" .InputMessage = "Enter the scale paramer or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Bayesian-case" 'test si on a qu'une variable If Range("C3") = "" Then 'dans ce cas c'est forcement la clef Range("G2").value = Range("C2").value End If Range("G1").FormulaR1C1 = "Key Variable one" Range("H1").FormulaR1C1 = "Key Variable two" Range("I1").FormulaR1C1 = "......." Range("G1:I1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "First Key Variable" .InputMessage = "Enter the key first key variable" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Second Key Variable" .InputMessage = "Enter the key second key variable" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("I2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Third Key Variable" .InputMessage = "Enter the key third key variable" .ShowInput = True End With Selection.Interior.ColorIndex = 35

Case Else Range("G1:J2").Clear End Selectfin:End Sub

Attribute VB_Name = "Feuil7"Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = TrueAttribute VB_TemplateDerived = FalseAttribute VB_Customizable = TrueSub Worksheet_Activate()Application.Run "MenuProbt.switch" Application.Run "Distribution.Distribution_Buttons_Panel"End SubSub Worksheet_Deactivate() On Error Resume Next Application.CommandBars("Distribution").Visible = FalseEnd SubSub Worksheet_Change(ByVal Target As Range) If Not (Target.Address = Range("F2").Address) Then GoTo fin Dim variablename As String variablename = Application.Run("Service.RemoveAllSpace", (Range("A2").value)) Range("G2", [G2].End(xlToRight)).Interior.ColorIndex = 0 Range("G2", [G2].End(xlToRight)).ClearContents 'Range("G2:J2").Interior.ColorIndex = 0 Range("G1:J1").Interior.ColorIndex = 0 Range("G1:J1").ClearContents 'If (lignecomptC() > 1) Then GoTo fin ' il y a des variables a droite

Select Case Target.value Case "Normal" Range("G1").FormulaR1C1 = "Mean" Range("H1").FormulaR1C1 = "Standard Deviation" Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Mean" .InputMessage = "Enter the mean of the distribution or a ProBT-formula " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Standard Deviation" .InputMessage = "Enter the Standard Deviation of the distribution or ProBT-formula " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Uniform"'TODO min max Dim minmaxpredicate As Long minmaxpredicate = Application.Run("ApiProbt.CCHasVariableAMinMax", variablename) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin If minmaxpredicate = 1 Then Range("G1").FormulaR1C1 = "[Min]" Range("H1").FormulaR1C1 = "[Max]" Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Min" .InputMessage = "Optionaly nnter the Min value or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Max" .InputMessage = "Optionaly enter the Max value or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 End If

Case "Histogram" ' dans ce cas on c'est forcement un new template : ne faut t-il pas le mettre ? If (Application.Run("Service.lignecomptC") > 1) Then GoTo fin

'TODO: histogram 1D Dim nbcases As Integer Range("G1").FormulaR1C1 = "Probability values" Range("H1").FormulaR1C1 = "......." Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With toto = Application.Run("ApiProbt.CCSelectFolder", ActiveWorkbook.name) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin nbcases = Application.Run("ApiProbt.CCGetVariableCardinality", variablename) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin For i = 1 To nbcases Cells(2, 6 + i).Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween '.InputTitle = "Probability Value or number of cases" '.InputMessage = "Enter a probability Value or the number of value in the histogram" '.ShowInput = True End With Selection.Interior.ColorIndex = 35 Next i Case "Dirac"'TODO: non-conditional dirac point Range("G1").FormulaR1C1 = "Value or function in c like format" Range("G1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Value or function" .InputMessage = "Enter a value or a function ex P(X|Y) : X=2*Y; " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Poisson"'TODO: non-conditional dirac point Range("G1").FormulaR1C1 = "Mean or ProBT-formula" Range("G1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Mean" .InputMessage = "Enter a value or a ProBT formula; " .ShowInput = True End With Selection.Interior.ColorIndex = 35

Case "Lognormal"

Range("G1").FormulaR1C1 = "Sigma" Range("H1").FormulaR1C1 = "Theta" Range("I1").FormulaR1C1 = "m" Range("G1:I1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Sigma" .InputMessage = "Enter the shape parameter or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Theta" .InputMessage = "Enter the location parameter or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("I2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "m" .InputMessage = "Enter the scale paramer or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Bayesian-case" 'test si on a qu'une variable If Range("C3") = "" Then 'dans ce cas c'est forcement la clef Range("G2").value = Range("C2").value End If Range("G1").FormulaR1C1 = "Key Variable one" Range("H1").FormulaR1C1 = "Key Variable two" Range("I1").FormulaR1C1 = "......." Range("G1:I1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "First Key Variable" .InputMessage = "Enter the key first key variable" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Second Key Variable" .InputMessage = "Enter the key second key variable" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("I2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Third Key Variable" .InputMessage = "Enter the key third key variable" .ShowInput = True End With Selection.Interior.ColorIndex = 35

Case Else Range("G1:J2").Clear End Selectfin:End Sub

Attribute VB_Name = "Feuil29"Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = TrueAttribute VB_TemplateDerived = FalseAttribute VB_Customizable = TrueSub Worksheet_Activate()Application.Run "MenuProbt.switch" Application.Run "Distribution.Distribution_Buttons_Panel"End SubSub Worksheet_Deactivate() On Error Resume Next Application.CommandBars("Distribution").Visible = FalseEnd SubSub Worksheet_Change(ByVal Target As Range) If Not (Target.Address = Range("F2").Address) Then GoTo fin Dim variablename As String variablename = Application.Run("Service.RemoveAllSpace", (Range("A2").value)) Range("G2", [G2].End(xlToRight)).Interior.ColorIndex = 0 Range("G2", [G2].End(xlToRight)).ClearContents 'Range("G2:J2").Interior.ColorIndex = 0 Range("G1:J1").Interior.ColorIndex = 0 Range("G1:J1").ClearContents 'If (lignecomptC() > 1) Then GoTo fin ' il y a des variables a droite

Select Case Target.value Case "Normal" Range("G1").FormulaR1C1 = "Mean" Range("H1").FormulaR1C1 = "Standard Deviation" Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Mean" .InputMessage = "Enter the mean of the distribution or a ProBT-formula " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Standard Deviation" .InputMessage = "Enter the Standard Deviation of the distribution or ProBT-formula " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Uniform"'TODO min max Dim minmaxpredicate As Long minmaxpredicate = Application.Run("ApiProbt.CCHasVariableAMinMax", variablename) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin If minmaxpredicate = 1 Then Range("G1").FormulaR1C1 = "[Min]" Range("H1").FormulaR1C1 = "[Max]" Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Min" .InputMessage = "Optionaly nnter the Min value or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Max" .InputMessage = "Optionaly enter the Max value or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 End If

Case "Histogram" ' dans ce cas on c'est forcement un new template : ne faut t-il pas le mettre ? If (Application.Run("Service.lignecomptC") > 1) Then GoTo fin

'TODO: histogram 1D Dim nbcases As Integer Range("G1").FormulaR1C1 = "Probability values" Range("H1").FormulaR1C1 = "......." Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With toto = Application.Run("ApiProbt.CCSelectFolder", ActiveWorkbook.name) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin nbcases = Application.Run("ApiProbt.CCGetVariableCardinality", variablename) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin For i = 1 To nbcases Cells(2, 6 + i).Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween '.InputTitle = "Probability Value or number of cases" '.InputMessage = "Enter a probability Value or the number of value in the histogram" '.ShowInput = True End With Selection.Interior.ColorIndex = 35 Next i Case "Dirac"'TODO: non-conditional dirac point Range("G1").FormulaR1C1 = "Value or function in c like format" Range("G1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Value or function" .InputMessage = "Enter a value or a function ex P(X|Y) : X=2*Y; " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Poisson"'TODO: non-conditional dirac point Range("G1").FormulaR1C1 = "Mean or ProBT-formula" Range("G1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Mean" .InputMessage = "Enter a value or a ProBT formula; " .ShowInput = True End With Selection.Interior.ColorIndex = 35

Case "Lognormal"

Range("G1").FormulaR1C1 = "Sigma" Range("H1").FormulaR1C1 = "Theta" Range("I1").FormulaR1C1 = "m" Range("G1:I1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Sigma" .InputMessage = "Enter the shape parameter or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Theta" .InputMessage = "Enter the location parameter or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("I2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "m" .InputMessage = "Enter the scale paramer or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Bayesian-case" 'test si on a qu'une variable If Range("C3") = "" Then 'dans ce cas c'est forcement la clef Range("G2").value = Range("C2").value End If Range("G1").FormulaR1C1 = "Key Variable one" Range("H1").FormulaR1C1 = "Key Variable two" Range("I1").FormulaR1C1 = "......." Range("G1:I1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "First Key Variable" .InputMessage = "Enter the key first key variable" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Second Key Variable" .InputMessage = "Enter the key second key variable" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("I2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Third Key Variable" .InputMessage = "Enter the key third key variable" .ShowInput = True End With Selection.Interior.ColorIndex = 35

Case Else Range("G1:J2").Clear End Selectfin:End Sub

Attribute VB_Name = "Feuil17"Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = TrueAttribute VB_TemplateDerived = FalseAttribute VB_Customizable = TrueSub Worksheet_Activate()Application.Run "MenuProbt.switch" Application.Run "Distribution.Distribution_Buttons_Panel"End SubSub Worksheet_Deactivate() On Error Resume Next Application.CommandBars("Distribution").Visible = FalseEnd SubSub Worksheet_Change(ByVal Target As Range) If Not (Target.Address = Range("F2").Address) Then GoTo fin Dim variablename As String variablename = Application.Run("Service.RemoveAllSpace", (Range("A2").value)) Range("G2", [G2].End(xlToRight)).Interior.ColorIndex = 0 Range("G2", [G2].End(xlToRight)).ClearContents 'Range("G2:J2").Interior.ColorIndex = 0 Range("G1:J1").Interior.ColorIndex = 0 Range("G1:J1").ClearContents 'If (lignecomptC() > 1) Then GoTo fin ' il y a des variables a droite

Select Case Target.value Case "Normal" Range("G1").FormulaR1C1 = "Mean" Range("H1").FormulaR1C1 = "Standard Deviation" Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Mean" .InputMessage = "Enter the mean of the distribution or a ProBT-formula " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Standard Deviation" .InputMessage = "Enter the Standard Deviation of the distribution or ProBT-formula " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Uniform"'TODO min max Dim minmaxpredicate As Long minmaxpredicate = Application.Run("ApiProbt.CCHasVariableAMinMax", variablename) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin If minmaxpredicate = 1 Then Range("G1").FormulaR1C1 = "[Min]" Range("H1").FormulaR1C1 = "[Max]" Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Min" .InputMessage = "Optionaly nnter the Min value or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Max" .InputMessage = "Optionaly enter the Max value or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 End If

Case "Histogram" ' dans ce cas on c'est forcement un new template : ne faut t-il pas le mettre ? If (Application.Run("Service.lignecomptC") > 1) Then GoTo fin

'TODO: histogram 1D Dim nbcases As Integer Range("G1").FormulaR1C1 = "Probability values" Range("H1").FormulaR1C1 = "......." Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With toto = Application.Run("ApiProbt.CCSelectFolder", ActiveWorkbook.name) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin nbcases = Application.Run("ApiProbt.CCGetVariableCardinality", variablename) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin For i = 1 To nbcases Cells(2, 6 + i).Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween '.InputTitle = "Probability Value or number of cases" '.InputMessage = "Enter a probability Value or the number of value in the histogram" '.ShowInput = True End With Selection.Interior.ColorIndex = 35 Next i Case "Dirac"'TODO: non-conditional dirac point Range("G1").FormulaR1C1 = "Value or function in c like format" Range("G1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Value or function" .InputMessage = "Enter a value or a function ex P(X|Y) : X=2*Y; " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Poisson"'TODO: non-conditional dirac point Range("G1").FormulaR1C1 = "Mean or ProBT-formula" Range("G1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Mean" .InputMessage = "Enter a value or a ProBT formula; " .ShowInput = True End With Selection.Interior.ColorIndex = 35

Case "Lognormal"

Range("G1").FormulaR1C1 = "Sigma" Range("H1").FormulaR1C1 = "Theta" Range("I1").FormulaR1C1 = "m" Range("G1:I1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Sigma" .InputMessage = "Enter the shape parameter or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Theta" .InputMessage = "Enter the location parameter or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("I2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "m" .InputMessage = "Enter the scale paramer or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Bayesian-case" 'test si on a qu'une variable If Range("C3") = "" Then 'dans ce cas c'est forcement la clef Range("G2").value = Range("C2").value End If Range("G1").FormulaR1C1 = "Key Variable one" Range("H1").FormulaR1C1 = "Key Variable two" Range("I1").FormulaR1C1 = "......." Range("G1:I1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "First Key Variable" .InputMessage = "Enter the key first key variable" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Second Key Variable" .InputMessage = "Enter the key second key variable" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("I2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Third Key Variable" .InputMessage = "Enter the key third key variable" .ShowInput = True End With Selection.Interior.ColorIndex = 35

Case Else Range("G1:J2").Clear End Selectfin:End Sub

Attribute VB_Name = "Feuil16"Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = TrueAttribute VB_TemplateDerived = FalseAttribute VB_Customizable = TrueSub Worksheet_Activate()Application.Run "MenuProbt.switch" Application.Run "Distribution.Distribution_Buttons_Panel"End SubSub Worksheet_Deactivate() On Error Resume Next Application.CommandBars("Distribution").Visible = FalseEnd SubSub Worksheet_Change(ByVal Target As Range) If Not (Target.Address = Range("F2").Address) Then GoTo fin Dim variablename As String variablename = Application.Run("Service.RemoveAllSpace", (Range("A2").value)) Range("G2", [G2].End(xlToRight)).Interior.ColorIndex = 0 Range("G2", [G2].End(xlToRight)).ClearContents 'Range("G2:J2").Interior.ColorIndex = 0 Range("G1:J1").Interior.ColorIndex = 0 Range("G1:J1").ClearContents 'If (lignecomptC() > 1) Then GoTo fin ' il y a des variables a droite

Select Case Target.value Case "Normal" Range("G1").FormulaR1C1 = "Mean" Range("H1").FormulaR1C1 = "Standard Deviation" Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Mean" .InputMessage = "Enter the mean of the distribution or a ProBT-formula " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Standard Deviation" .InputMessage = "Enter the Standard Deviation of the distribution or ProBT-formula " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Uniform"'TODO min max Dim minmaxpredicate As Long minmaxpredicate = Application.Run("ApiProbt.CCHasVariableAMinMax", variablename) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin If minmaxpredicate = 1 Then Range("G1").FormulaR1C1 = "[Min]" Range("H1").FormulaR1C1 = "[Max]" Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Min" .InputMessage = "Optionaly nnter the Min value or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Max" .InputMessage = "Optionaly enter the Max value or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 End If

Case "Histogram" ' dans ce cas on c'est forcement un new template : ne faut t-il pas le mettre ? If (Application.Run("Service.lignecomptC") > 1) Then GoTo fin

'TODO: histogram 1D Dim nbcases As Integer Range("G1").FormulaR1C1 = "Probability values" Range("H1").FormulaR1C1 = "......." Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With toto = Application.Run("ApiProbt.CCSelectFolder", ActiveWorkbook.name) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin nbcases = Application.Run("ApiProbt.CCGetVariableCardinality", variablename) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin For i = 1 To nbcases Cells(2, 6 + i).Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween '.InputTitle = "Probability Value or number of cases" '.InputMessage = "Enter a probability Value or the number of value in the histogram" '.ShowInput = True End With Selection.Interior.ColorIndex = 35 Next i Case "Dirac"'TODO: non-conditional dirac point Range("G1").FormulaR1C1 = "Value or function in c like format" Range("G1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Value or function" .InputMessage = "Enter a value or a function ex P(X|Y) : X=2*Y; " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Poisson"'TODO: non-conditional dirac point Range("G1").FormulaR1C1 = "Mean or ProBT-formula" Range("G1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Mean" .InputMessage = "Enter a value or a ProBT formula; " .ShowInput = True End With Selection.Interior.ColorIndex = 35

Case "Lognormal"

Range("G1").FormulaR1C1 = "Sigma" Range("H1").FormulaR1C1 = "Theta" Range("I1").FormulaR1C1 = "m" Range("G1:I1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Sigma" .InputMessage = "Enter the shape parameter or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Theta" .InputMessage = "Enter the location parameter or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("I2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "m" .InputMessage = "Enter the scale paramer or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Bayesian-case" 'test si on a qu'une variable If Range("C3") = "" Then 'dans ce cas c'est forcement la clef Range("G2").value = Range("C2").value End If Range("G1").FormulaR1C1 = "Key Variable one" Range("H1").FormulaR1C1 = "Key Variable two" Range("I1").FormulaR1C1 = "......." Range("G1:I1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "First Key Variable" .InputMessage = "Enter the key first key variable" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Second Key Variable" .InputMessage = "Enter the key second key variable" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("I2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Third Key Variable" .InputMessage = "Enter the key third key variable" .ShowInput = True End With Selection.Interior.ColorIndex = 35

Case Else Range("G1:J2").Clear End Selectfin:End Sub

Attribute VB_Name = "Feuil15"Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = TrueAttribute VB_TemplateDerived = FalseAttribute VB_Customizable = TrueSub Worksheet_Activate()Application.Run "MenuProbt.switch" Application.Run "Distribution.Distribution_Buttons_Panel"End SubSub Worksheet_Deactivate() On Error Resume Next Application.CommandBars("Distribution").Visible = FalseEnd SubSub Worksheet_Change(ByVal Target As Range) If Not (Target.Address = Range("F2").Address) Then GoTo fin Dim variablename As String variablename = Application.Run("Service.RemoveAllSpace", (Range("A2").value)) Range("G2", [G2].End(xlToRight)).Interior.ColorIndex = 0 Range("G2", [G2].End(xlToRight)).ClearContents 'Range("G2:J2").Interior.ColorIndex = 0 Range("G1:J1").Interior.ColorIndex = 0 Range("G1:J1").ClearContents 'If (lignecomptC() > 1) Then GoTo fin ' il y a des variables a droite

Select Case Target.value Case "Normal" Range("G1").FormulaR1C1 = "Mean" Range("H1").FormulaR1C1 = "Standard Deviation" Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Mean" .InputMessage = "Enter the mean of the distribution or a ProBT-formula " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Standard Deviation" .InputMessage = "Enter the Standard Deviation of the distribution or ProBT-formula " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Uniform"'TODO min max Dim minmaxpredicate As Long minmaxpredicate = Application.Run("ApiProbt.CCHasVariableAMinMax", variablename) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin If minmaxpredicate = 1 Then Range("G1").FormulaR1C1 = "[Min]" Range("H1").FormulaR1C1 = "[Max]" Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Min" .InputMessage = "Optionaly nnter the Min value or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 Range("H2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Max" .InputMessage = "Optionaly enter the Max value or a ProBT-formula" .ShowInput = True End With Selection.Interior.ColorIndex = 35 End If

Case "Histogram" ' dans ce cas on c'est forcement un new template : ne faut t-il pas le mettre ? If (Application.Run("Service.lignecomptC") > 1) Then GoTo fin

'TODO: histogram 1D Dim nbcases As Integer Range("G1").FormulaR1C1 = "Probability values" Range("H1").FormulaR1C1 = "......." Range("G1:H1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With toto = Application.Run("ApiProbt.CCSelectFolder", ActiveWorkbook.name) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin nbcases = Application.Run("ApiProbt.CCGetVariableCardinality", variablename) If Application.Run("CWorksheets.process_kernel_error") > 0 Then GoTo fin For i = 1 To nbcases Cells(2, 6 + i).Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween '.InputTitle = "Probability Value or number of cases" '.InputMessage = "Enter a probability Value or the number of value in the histogram" '.ShowInput = True End With Selection.Interior.ColorIndex = 35 Next i Case "Dirac"'TODO: non-conditional dirac point Range("G1").FormulaR1C1 = "Value or function in c like format" Range("G1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Value or function" .InputMessage = "Enter a value or a function ex P(X|Y) : X=2*Y; " .ShowInput = True End With Selection.Interior.ColorIndex = 35 Case "Poisson"'TODO: non-conditional dirac point Range("G1").FormulaR1C1 = "Mean or ProBT-formula" Range("G1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G2").Select With Selection.Validation .Delete .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _ :=xlBetween .InputTitle = "Mean" .InputMessage = "Enter a value or a ProBT formula; " .ShowInput = True End With Selection.Interior.ColorIndex = 35

Case "Lognormal"

Range("G1").FormulaR1C1 = "Sigma" Range("H1").FormulaR1C1 = "Theta" Range("I1").FormulaR1C1 = "m" Range("G1:I1").Select With Selection .Interior.ColorIndex = 36 .Font.name = "Arial" .Font.Size = 10 End With Range("G