Latin hypercube sample from beta distribution
조회 수: 26 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Aditya
2025년 2월 3일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Industrial Statistics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!