CS395T/CAM383M Computational Statistics  

Go Back   CS395T/CAM383M Computational Statistics > CS395T/CAM383M (Spring 2011) Lectures and Student Participation > Homework Assignments and Student Postings > HW 5

Thread Tools Display Modes
Old 05-12-2011, 11:16 AM
Yanan Yanan is offline
Join Date: Jan 2011
Posts: 15
Default Hw5

Proof for Problem 1 is attached. Code for Problem 2.
data = load('hw5_data.txt','-ASCII');
[N,M] = size(data);

% mu and sigma
mu = mean(data);
sigma = cov(data);

%chi-square and p-value
chi2 = zeros(N,1);
p = zeros(N,1);
for i = 1:N
    chi2(i) = (data(i,:)-mu)*inv(sigma)*(data(i,:)-mu)';
    p(i) = 1-chi2cdf(chi2(i),5);

[rank, index] = sort(p);
alpha = 0.1;
rej = [];
j = 1;
for i = 1:N
    if p(index(i)) < i*alpha/N
        rej(j) = index(i);
        j = j+1;
Attached Images
File Type: pdf hw5.sol.pdf (281.7 KB, 863 views)
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 11:50 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.