CS代考 % ————————————————————————-

% —————————————————————————-
% This Matlab code allows you to verify the Central Limit Theorem (CLT)
% The population is Exponential with mean = true_mean
% —————————————————————————-

Copyright By PowCoder代写 加微信 powcoder

% clean up the environment

% sample size
sample_size = 10000; % Choose the number of observations for each sample
smaller_sample_size = 1000; % Choose the number of observations for each (smaller) sample
number_of_samples = 1000; % Choose the number of samples

% population parameters
true_mean = 2; % mean of the population

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%—————————————————————————————————————–
% The CLT for the mean WITHOUT standardization –
% As the number of observations increases, the distribution of the “sample” mean
% becomes more and more concentrated around the “population” mean –
% In fact, the variance of the sample mean goes to zero (see slides for Lecture 1)
%—————————————————————————————————————–

% initialize the vectors
small_sample = zeros(smaller_sample_size, number_of_samples);
sz = size(small_sample);
larger_sample = zeros(sample_size, number_of_samples);
sz1 = size(larger_sample);

% create small and large samples
X_small = random(‘Exponential’, true_mean, sz);
X_large = random(‘Exponential’, true_mean, sz1);

% compute the mean of each sample
mean_small = mean(X_small);
mean_large = mean(X_large);

% plot the distribution of the sample means
histogram(mean_small,’normalization’,’pdf’, “FaceColor”, “red”);
histogram(mean_large,’normalization’,’pdf’, “FaceColor”, “blue”);

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com