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

Reply
 
Thread Tools Display Modes
  #1  
Old 03-06-2011, 12:20 AM
nclement nclement is offline
Member
 
Join Date: Jan 2011
Posts: 13
Default Nathan Homework

Attached is Problem 1

Here is the code for Problem 2:
Code:
load hw5_data.txt;
mu = mean(hw5_data)'
sigma = cov(hw5_data)
chival = @(x) (x-mu)'*inv(sigma)*(x-mu);

for i=1:1010,
    finChi(i) = chival(hw5_data(i,:)');
end

pvals = 1-chi2cdf(finChi,5);

[sorted_chi, sorted_idx] = sort(pvals);

alpha=0.1;
sorted_idx(sorted_chi<(1:1010)/1010*alpha)
and the output:
Code:
>> hw5_code

mu =

    0.5778
   -0.2151
   -0.8231
    1.1429
   -1.0530


sigma =

    4.4106    0.3001   -2.5004   -2.6993    0.2880
    0.3001    3.3049   -0.7716   -0.2023    0.7496
   -2.5004   -0.7716    4.2323    3.5909   -1.0843
   -2.6993   -0.2023    3.5909    3.6902   -0.0307
    0.2880    0.7496   -1.0843   -0.0307    4.4111


ans =

  Columns 1 through 6

        1004        1005        1007        1002        1003         495

  Columns 7 through 8

        1008        1001
Attached Images
File Type: pdf hs5Response.pdf (37.6 KB, 377 views)
Reply With Quote
Reply

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 01:31 PM.


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