About the marginal parameters in Sobol’ indices

Dear UQLab Team,

I encountered a problem when doing Sobol sensitivity analysis. If the distribution of a design variable is determined, such as two parameter Weibull distribution, the shape parameter is 7.101 and the scale parameter is 2636.214. My question is:InputOpts.Marginals(1).Parameters=[A,B], are A and B shape parameters and scale parameters, respectively? I’m a little vague about this. In addition, if it is a three parameter Weibull distribution, how to set the parameters?

The following is the process of a simple program, but it prompts an error: nonFiniteContourError.
Specify the marginals as follows:
InputOpts.Marginals(1).Name = ‘R1’;
InputOpts.Marginals(1).Type = ‘Weibull’;
InputOpts.Marginals(1).Parameters = [7.101 2636.214];
InputOpts.Marginals(2).Name = ‘R2’;
InputOpts.Marginals(2).Type = ‘Weibull’;
InputOpts.Marginals(2).Parameters = [8.667 5412.962];
InputOpts.Marginals(3).Name = ‘R3’;
InputOpts.Marginals(3).Type = ‘Weibull’;
InputOpts.Marginals(3).Parameters = [8.382 4334.643];
InputOpts.Marginals(4).Name = ‘R4’;
InputOpts.Marginals(4).Type = ‘Weibull’;
InputOpts.Marginals(4).Parameters = [4.664 2349.128];

The response function is Y=R1* R2* R3* R4

Thanks in advance

Hi @FANFAN,

As far as I know, the Weibull distribution in the UQlab input module is defined by only two parameters, namely shape, and scale. When you create the structure as in

InputOpts.Marginals(1).Name = ‘R1’;
InputOpts.Marginals(1).Type = ‘Weibull’;
InputOpts.Marginals(1).Parameters = [A B];
...

where A is the scale parameter and B is the shape parameter.
Regarding the three-parameter distribution, i.e., the location parameter, I never used it before. Have you tried transforming your data before, i.e., applying the location parameter to your input xi? I do not know if it may work.

In conclusion, I think the code error is given by the Weibull distribution’s parameters given in the InputOpts structure. Try to switch them :slight_smile: as in

InputOpts.Marginals(1).Name = ‘R1’;
InputOpts.Marginals(1).Type = ‘Weibull’;
InputOpts.Marginals(1).Parameters = [2636.214 7.101];
InputOpts.Marginals(2).Name = ‘R2’;
InputOpts.Marginals(2).Type = ‘Weibull’;
InputOpts.Marginals(2).Parameters = [5412.962 8.667];
InputOpts.Marginals(3).Name = ‘R3’;
InputOpts.Marginals(3).Type = ‘Weibull’;
InputOpts.Marginals(3).Parameters = [4334.643 8.382];
InputOpts.Marginals(4).Name = ‘R4’;
InputOpts.Marginals(4).Type = ‘Weibull’;
InputOpts.Marginals(4).Parameters = [2349.128 4.664];

@Gian.Marco.Melito Thank you very much for your help. In addition, do you know how to judge the convergence when calculating the sensitivity? I want to draw a graph with sampling time as horizontal coordinate and sensitivity value as vertical coordinate. I also tried to write a loop to save the results of each sampling, but it was still unsuccessful.
Thanks again! Look forward to your reply!

Hi @FANFAN,
I am not sure if I got your question correctly.
I suppose you are computing the Sobol indices (?) from a metamodel, e.g., PCE, and you want to analyze the value of the Sobol indices for each input variable of your model by varying the number of samples.
What I would do is:

Ns = [10 100 1000 1e4];
%% Start definition of your input
InputOpts.Marginals(1).Name = 'R1';
InputOpts.Marginals(1).Type = 'Weibull';
InputOpts.Marginals(1).Parameters = [A B];
...
myInput = uq_createInput(InputOpts);
% collect input sample 
for ns = 1:Ns
mySample = uq_getSample(myInput,Ns,<yourSamplingMethod>) % mc,lhs,...

%% Define your metamodel (suppose PCE)
metaOpts.Type = 'Metamodel';
metaOpts.MetaType = 'PCE';
...
metaOpts.ExpDesign.X = mySample;
metaOpts.ExpDesign.Y = yourOutput;
myPCE = uq_createModel(metaOpts);

%% perform SA from PCE
SAopts.Type = 'Sensitivity';
SAopts.Method = 'Sobol';
SobolIndices= uq_createAnalysis(SAopts);
end

Otherwise, if you have the model running in the UQlab infrastructure, as in FullModel given, you can input the command to the PCE options as in

metaOpts.ExpDesign.NSamples = ns;

So you do not have to create the sampling in the loop.

Let me know if this can be of any inspiration
Best
Gian