Explore the t-distribution by the following procedure: a. Draw a sample of n poi
ID: 3268989 • Letter: E
Question
Explore the t-distribution by the following procedure: a. Draw a sample of n points from the standard normal distribution. b. Compute the mean and standard deviation of this sample. c. Form the statistic t = (x bar - mu)/(s/squareroot n) where x bar and s are the mean and the standard deviation computed in (b), mu = 0 (standard normal distribution) and n = 20. Store this value d. Repeat steps (a)-(c) about 5000 times. e. Plot the histograms of the statistic and verify visually that it looks like a t-distribution. Determine the two-sided probabilities associated with 60%, 70%, 80%, 90%, 95% and 99%. (We have been working exclusively with two-sided probabilities in this class). f. Repeat the process a-e for various values of n (degrees of freedom) (Some relevant MATLAB functions: randn, mean, std, hist, prctile)Explanation / Answer
(a)
%Initialize n to any number.
r=randn(n)
(b)
%To find mean and standard deviation
mean_r=mean(r);
std_r=std(r);
(c)
%To compute statistic t
r=randn(20)
mean_r=mean(r)
std_r=std(r)
t=mean_r/(std_r*sqrt(20))
(d)
for i=1:5000
r=randn(20)
mean_r=mean(r)
std_r=std(r)
t=mean_r/(std_r*sqrt(20))
end
(e)
n=20;
t=[]
for i=1:5000
r=randn(n);
mean_r=mean(r);
std_r=std(r);
t(i)=mean_r/(std_r*sqrt(20));
end
%Plot histogram
hist(t)
(f)
You can change thae values of n.
function []=plothistrandomvalues(n)
r=randn(n)
for i=1:5000
mean_r=mean(r)
std_r=std(r)
t=mean_r/(std_r*sqrt(20))
end
hist(t)
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.