Central limit theorem understanding N

8 vues (au cours des 30 derniers jours)
Aldo
Aldo le 24 Nov 2016
M = 1e3;
N = 4;
mu = 5;
X = exprnd(mu, M, N);
S = cumsum(X, 2);
for k = 1:N
hist(S(:, k), 30)
xlabel(num2str(k))
pause(0.1)
end
I am trying to understand this code, so my question is what does N represent. And what happens when N is increased or decreased? Why is that?

Réponses (3)

KSSV
KSSV le 24 Nov 2016
Central limit theorem states that, when independent random variables are added, their sum tends toward a normal distribution commonly known as a bell curve.
In the code exprnd(mu, M, N), generates a random numbers of size MXN with mean mu. The theorem states that as the number of random numbers approaches infinity their sum fits to normal distribution.
In your code, you can change N vlaues too. Chekc this code.
clc ; clear all ;
M = 1e3;
N = 4;
mu = 5;
X = exprnd(mu, M, N);
S = cumsum(X, 2);
for k = 1:N
hist(S(:, k), 30)
hold on
histfit(S(:,k),30)
hold off
xlabel(num2str(k))
drawnow
pause(0.1)
end
  2 commentaires
Aldo
Aldo le 24 Nov 2016
How come I still get normal distribution even if N = 1, shouldn't all ´have the same probability?
KSSV
KSSV le 24 Nov 2016
It is the M which matters...

Connectez-vous pour commenter.


Star Strider
Star Strider le 24 Nov 2016
The ‘X’ matrix is an (MxN) matrix of exponentially-distributed numbers. The code as written does not illustrate the Central Limit Theorem. This version of it approaches the normal distribution with increasing values of ‘M’:
M = 1e3;
N = 4;
mu = 5;
X = exprnd(mu, M, N);
S = cumsum(X, 2);
hist(S(:,4), 30)
I invite you to explore the Central Limit Theorem on your own, with your own code, so you understand how it works. The convolution (the conv function) can be helpful in understanding the Central Limit Theorem and the statistical properties of probability distributions. (It’s late here and I’m tired, so I’ll leave you to explore that on your own.)

faruk bo
faruk bo le 3 Déc 2018
You should use mean function instead of cumsum. cumsum function isn't appropriate for CLT.

Catégories

En savoir plus sur Model Statistics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by