Generating a distribution around a parameter using monte carlo simulation.

조회 수: 39 (최근 30일)
Gumps
Gumps 2018년 10월 25일
댓글: Gumps 2018년 10월 31일
Hello, I wish for someone to help me explain (with a code example) how i can generate a distribution around a value (say 0.007695) using Monte Carlo simulation. I understand that I might first need to generate set of random variables using 0.007695 as control.
I will be grateful to get a response. Am just a basic user of matlab

채택된 답변

Jeff Miller
Jeff Miller 2018년 10월 27일
The Gaussian distribution has two parameters, mean and standard deviation. Once you decide on values for those, it is easy to generate a sample of random numbers. For example:
mu = 0.0076; % the mean you asked for
sigma = 0.0003; % adjust to make the distribution as wide as you want.
samplesize = 1000;
randvals = randn(samplesize,1)*sigma + mu;
histogram(randvals);
  댓글 수: 6
Gumps
Gumps 2018년 10월 31일
Hello Jeff, I have just looked at the histcounts. Not clear enough

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

possibility
possibility 2018년 10월 26일
Generally, the way it works is you already possess the data samples (say millions of them) and find the histogram of the data (frequency of the values that appears in the data). After that, you pick the optimum distribution model (Gaussian, Laplacian, chi-square, etc.) that fits best to your samples.
But, if you're trying to ask "how to generate samples from a distribution with a given statistical parameter (for ex: mean)", that would have meaningful answers.
One example,
randn
command generates samples from a gaussian distribution. Or
rand
generates samples from a uniform distribution. Just type
help rand
for details.
Hope that helps.
  댓글 수: 1
Gumps
Gumps 2018년 10월 26일
Hello Yavuz, thank you for quick response. Actually, I just have a simple value of say 0.0076 and I want to generate random samples around it and after which I can now define these samples with a gaussian distribution taking my known value as the mean... I would really appreciate if you can be of great help. Thank you

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by