MPGSA questions regarding plot visualizations and log-distributed sampling
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I have two questions regarding MPGSA analyses:
- When analyzing many independent variables, I cannot visualize the subplots (see attached) when the plot() and histogram() methods are run. Is it possible to break these into individual figures?
- It appears the x axes are in linear scale, although I sampled the parameters using loguniform distributions. Is it possible to display the x axes in log scale when sampling is done on log scale?
- Also, along the lines of (2), can I confirm whether the logarithmic distribution of the sampling is taken into account when the K-S calculations are performed?
Thank you,
Abed
0 comentarios
Respuestas (1)
Florian Augustin
el 7 de En. de 2022
Hello Abed,
You can use the name-value pair Parameters in the plot or histogram methods to selectively visualize GSA results. You can either specify the input parameters as a numeric index or via their names. Looking at the screenshot you attached, you could select kdA and kdB as follows:
plot(mpgsaResults, "Parameters", [3, 4]);
% or
plot(mpgsaResults, "Parameters", ["kdA", "kdB"]);
In the current version of Matlab (R2021b), there is no name-value pair in the GSA plot methods to change the axes scale. But here is a little script you could use/tweak to manually change the scale:
function figHandle = plotInXLogScale(mpgsaResults, varargin)
% Create plot
figHandle = plot(mpgsaResults, varargin{:});
% Get axes handles from figure
axes = findobj(figHandle, "Type", "Axes");
% Change x-scale of axes to log-scale
for i = 1:numel(axes)
axes(i).XScale = "log";
end
end
I am not sure I understand the third question, but you can inspect the parameter samples on the MPGSA results object, e.g. by plotting them in a histogram:
% Plot parameter samples for input parameter kdA:
histogram(results.ParameterSamples.("kdA"));
Let me know if this doesn't answer your question.
Hope this helps.
Best,
-Florian
2 comentarios
Florian Augustin
el 7 de En. de 2022
Hi Abed,
The simple change of scale of the axes also works for the histogram plots. However, this does not change, the bin boundaries, which will remain equidistant on a linear scale. Changing the binning boundaries to be equidistant on a log-scale is not supported.
To get equidistant bins on a log-scale, you have to create custom histogram plots:
%% Setup
% -----
% Index of classifier in the order specified in sbiompgsa:
classIdx = 1; % choose 1 if you only have one classifier
% Index of parameter in the order specified in sbiompgsa:
paramIdx = 3; % this would select kdA
% Create bounds of bins in log scale:
binEdges = logspace(2, 4, 10); % example: 10 equidistant bounds on log-scale between 10^2 and 10^4.
%% Plot
% ----
% Parameter samples
samples = mpgsaResults.ParameterSamples{:, paramIdx};
% Index of samples that support classifier:
supportSamples = mpgsaResults.SupportHypothesis{:, classIdx};
% Index of valid samples (for which simulation did not fail):
validSamples = mpgsaResults.SimulationInfo.ValidSample;
% Plot:
figure(1); clf;
histogram(samples(supportSamples & validSamples), "BinEdges", binEdges, "Normalization", "probability");
hold("on");
histogram(samples(~supportSamples & validSamples), "BinEdges", binEdges, "Normalization", "probability");
To visualize the values of the K-S statistic, I would recommend using bar plots. There the numeric values are are more apparent than in the eCDF plot plots. You can also access the raw numeric values as a table:
mpgsaResults.KolmogorovSmirnovStatistics
Best,
Florian
Comunidades de usuarios
Más respuestas en SimBiology Community
Ver también
Categorías
Más información sobre Scan Parameter Ranges en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!