STA5107_FRADE_HW6 - i=1:m for j=1:B(i u1 =...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
STA5107: Dr. Srivastava Homework 6 Jaime Frade 1. OUTPUT a) mean_x = 579.5333 mean_y = 3.0873 rou = 0.8429 b) Table for the estimates for the standard errors for B B 25 50 100 200 500 1000 2000 5000 standard errors X 48.6809 31.3001 37.166 47.3164 31.5315 38.4516 36.1316 33.3599 standard errors Y 0.2113 0.1878 0.1661 0.1322 0.1995 0.2106 0.2033 0.1437 c) Histograms: At B=2000, can see that histogram correlation coefficients using the random sample and boostrap replicates are very similar.
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
STA5107: Dr. Srivastava Homework 6 Jaime Frade CODE clear all clc LawSchoolData ; [m,n] = size(X); n1=15; % obtain a random start num = ceil(rand*5); for i=num:num:n1*num; x1(ceil(i/num),:) = X(i,:); end ; % part a mean_x = mean(x1(:,1)) mean_y = mean(x1(:,2)) rou = corr(x1(:,1),x1(:,2)) sd_x = std(x1(:,1)); sd_y = std(x1(:,2)); % part and c B= [25 50 100 500 1000 2000 5000]; m=size(B); for
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: i=1:m; for j=1:B(i); u1 = randint(1,n1,[1,n1]); for k=1:n1; x2(k,:) = x1(u1(k),:); end ; sd_m1x(j)=std(x2(:,1)); sd_m1y(j)=std(x2(:,2)); rou_m1(j)=corr(x2(:,1),x2(:,2)); end ; sd_m2_x=mean(sd_m1x); sd_m2_y=mean(sd_m1y); rou_m2=mean(rou_m1); for j2=1:B(i); u2 = randint(1,n1,[1,n1]); for k2=1:n1; x3(k2,:) = x1(u2(k2),:); end ; sd_m2x(j2)=std(x3(:,1)); sd_m2y(j2)=std(x3(:,2)); rou_m2(j2)=corr(x3(:,1),x3(:,2)); end ; sd_m2x(end) sd_m2y(end) if B(i)==2000 figure(1) hist(rou_m1); title( 'Bootstrap Method for B=2000' ); figure(2) hist(rou_m2); title( 'Random Sample for B=2000' ); end ; end ; STA5107: Dr. Srivastava Homework 6 Jaime Frade 2. OUTPUT a) B 25 50 100 200 500 1000 2000 standard errors 2.1495 2.0274 1.9761 1.9535 2.0757 2.0858 1.9777 b) CODE 3....
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern