Latin hypercube sample from beta distribution
27 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I need to extract 10000 samples from a beta distribution with the help of Latin hypercube. the "lhsnorm" command only helps in case of a normal distribution. I also could not find much under "lhsdesign". How should I do this? Thank you everyone in advance.
0 Kommentare
Antworten (1)
Aditya
am 3 Feb. 2025
Hi Eagle
To generate samples from a beta distribution using Latin Hypercube Sampling (LHS), you can use the lhsdesign function to generate samples from a uniform distribution and then transform these samples to follow a beta distribution. Here's a step-by-step guide on how to achieve this in MATLAB:
% Parameters for the beta distribution
a = 2; % Shape parameter alpha
b = 5; % Shape parameter beta
% Number of samples
numSamples = 10000;
% Generate Latin hypercube samples from a uniform distribution
uniformSamples = lhsdesign(numSamples, 1);
% Transform uniform samples to beta distribution using the inverse CDF
betaSamples = betainv(uniformSamples, a, b);
% Plot the histogram of the generated beta samples
figure;
histogram(betaSamples, 50, 'Normalization', 'pdf');
hold on;
% Plot the theoretical beta distribution for comparison
x = linspace(0, 1, 100);
y = betapdf(x, a, b);
plot(x, y, 'r-', 'LineWidth', 2);
xlabel('Value');
ylabel('Probability Density');
title('Beta Distribution Samples using Latin Hypercube Sampling');
legend('Sampled Data', 'Theoretical Beta PDF');
0 Kommentare
Siehe auch
Kategorien
Mehr zu Industrial Statistics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!