In: Statistics and Probability
A sample of five 4-sided dice are thrown.
a) What is the space of all possible outcomes?
b) Plot the probability mass function for the mean sample outcome.
c) Calculate the standard deviation from the mass function found in part b.
d) Compare the value found in part c with the value found using the central limit theorem.
Answer:
Raw Copyable script:
%%%a.
%number of possible outcomes
count = power(4,5)
%set the experiment credentials
%sides of the die
sides=[1 2 3 4]
samples=5
numSides = numel(sides) ;
%to determine the sample space
if numSides==0 || samples == 0,
SampleSpace = zeros(numSides,samples) ;
array = zeros(numSides,samples) ;
elseif samples == 1,
% return column vectors
SampleSpace = sides(:) ;
array = (1:numSides).' ;
else
[Y{samples:-1:1}] = ndgrid(1:numSides) ;
array = reshape(cat(samples+1,Y{:}),[],samples) ;
SampleSpace = sides(array) ;
end
%print the sample space
SampleSpace
%%%%%b
%to find the probability mass function
PMF = sum(SampleSpace,2)/5
numel(PMF)
%find the distribution of the space values
%find the discrete entries
a = unique(PMF)
out = [a,histc(PMF(:),a)];
%find the counts
x = out(:,2)
%plot the probablity mass function
plot(a,x)
%%%%c
%%find the standard deviation
stanardDeviation=std(PMF)