====== Sensitivity analysis toolbox example - External model ====== **Overview** The following example demonstrates how to perform a sensitivity analysis of an external model using the importing/export functionality of the sensitivity toolbox. The sensitivity analysis of an external model is performed in the following steps: - Create parameters in Ecolego corresponding to the model inputs in the external model - Assign probability density functions to the parameters in Ecolego - Generate probabilistic values for the parameters (Sensitivity toolbox->input samples->generate) - Export the samples of the parameters (Sensitivity toolbox->Input samples->export) - //Simulate samples of model outputs externally and put the samples in a tab delimited textfile// - Import the model outputs (Sensitivity toolbox->outputs->import) - Inspect the sensitivity analysis indices (Sensitivity toolbox->results->create correlation table) **The model** The model in this example is the three parameter ishigami model\\ \\ //y = sin(x1)+7.0*sin(x2)^2.0+0.1*x3^4.0*sin(x1)\\ // \\ The model will not be created in Ecolego, but evaluated in excel as a external model.\\ \\ **Generation of parameter samples in Ecolego** Create the three parameters x1,x2,x3 in Ecolego and assign them the distribution unif(min=-3.14,max=3.14).\\ \\ **Opening the Sensitivity analysis perspective** Open the Sensitivity Analysis toolbox perspective by clicking {{:SensitivityToolboxPerspective24.png|SensitivityToolboxPerspective24}} in the Ecolego toolbar\\ \\ **Selection of probabilistic parameters** |{{:SensitivityToolboxParameterSelectionTab.png|SensitivityToolboxParameterSelectionTab}}|Go to Settings->Parameter selection to open the [[Parameter_selection_view|Parameter selection view]]. Here, the parameters for which the sensitivity analysis should be run are selected.\\\\ \\\\ //Select the three parameters x1,x2,x3 by moving them to the right in the parameter selection view//| \\ **Selection of Sensitivity analysis method** |{{:SensitivityToolboxMethodTab.png|SensitivityToolboxMethodTab}}|Go to Settings->Method to open the [[Sensitivity_analysis_method_view|Sensitivity analysis method view]]. Here, the [[Sensitivity_analysis_in_Ecolego#Methods|sensitivity analysis method]] and its settings is selected. **Note that only the probabilistic method can be used with external models.**\\\\ \\\\ //Select the method Probabilistic with the following settings:\\\\ \\\\ Base sample size: 1000\\\\ Sampling type: Latin Hypercube\\\\ Calculate second order indices: Unchecked\\\\ Seed: Auto\\\\ //| \\ **Generating and exporting parameter samples** Go to Analysis->Inputs samples->Generate. This will generate samples for the parameters. Go to Analysis->Inputs samples. Select Analysis->Inputs samples->Export. In the dialog that appears, select all variables and press OK. Then select which file to export the samples to (for example “IshigamiInputs.txt”). **Evaluating the external model** Open the file with the exported samples in Excel. Evalute the following expression in a separate column of length 1000 using the samples for x1,x2,x3: //y = sin(x1)+7.0*sin(x2)^2.0+0.1*x3^4.0*sin(x1)\\ // \\ Export the resulting column from excel as a new text file named IshigamiOutputs.txt. **Sensitivity analysis** To perform the sensitivity analysis, both the input samples and outputs samples that were used for the model evaluation are first imported into ecolego. Import the input samples by selecting Analysis->Inputs->Import and selecting the file containing the samples generated for the model inputs (IshigamiInputs.txt). Import the output samples by selecting Analysis->Outputs->Import and selecting the file containing the samples generated for the model outputs (IshigamiOutputs.txt). Go to Analysis->Result. Select the output y to open a correlation table to inspect the sensitivity indices.