%Problem Set 7 Due Wednesday Oct. 17, 2007 close all; %closes all figures clc; %clears the screen clear; %clears the memory %set the normal and unit density seeds randn('seed',1234); rand('seed',0); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %2. a. %m x n matrix %note that in our homework it says length "n" but to retain standard %matrix notation we use length "m" of a matrix %m is a 6 x 1 m = [5, 10, 30, 100, 500, 1000]; n = 10000; dof = 3; figure; for i = 1:1:6 %generate the random draws x = trnd(dof,m(1,i),n); xbar = mean(x)'; %plot the vector subplot(4,6,i); plot(xbar,'k'); axis([0 n -6 6]); %plot the histogram subplot(4,6,i+6); edges = [-4:0.05:4]; hist(xbar,edges); %plot the histogram of standardized means ybar = xbar./[std(x)'/sqrt(m(1,i))]; subplot(4,6,i+12); hist(ybar); axis([-10 10 0 7500]); set(gca, 'Xtick', [-10 0 10]); %smoothed the histrogram distribution using Gaussian Kernel density estimator [ybarsmooth, domain] = kernel(ybar); subplot(4,6,i+18); plot(domain,ybarsmooth,'k'); %plot(ybarsmooth,'k'); axis([-10 10 0 0.5]); end