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:49 PM
meiyen.chen meiyen.chen is offline
Member
 
Join Date: Jan 2011
Posts: 33
Default HW5 solutions

Thanks for any comments in advance!
Attached Images
File Type: pdf ChenMY_hw5.pdf (85.1 KB, 355 views)
Attached Files
File Type: txt hw5Problem2.txt (3.4 KB, 427 views)
File Type: txt hw5_code.txt (1.2 KB, 372 views)
Reply With Quote
  #2  
Old 03-06-2011, 08:09 PM
ilevy ilevy is offline
Member
 
Join Date: Jan 2011
Posts: 43
Default

Meiyen,

Nice job! A couple comments about your matlab code:
* corr(data) produces a correlation matrix. Instead, you want cov(data). Apparently there are a couple uses of inv(corr(data)) [1], but it's not what you want.
* A more elegant decision loop might be:
Code:
for j = 1:nData
    if(pV(j) >= (j/nData)*alpha)
        break
    end
end
rejected = pI(1:j-1);
This is because after we hit an index that exceeds the threshold we should stop, even if there are points later along that go back below the threshold.

By the way, fprintf without a file identifier prints to screen. Personally, I like it more than using sprintf.

Last edited by ilevy; 03-06-2011 at 08:28 PM.
Reply With Quote
  #3  
Old 03-07-2011, 12:09 PM
xwang xwang is offline
Member
 
Join Date: Jan 2011
Posts: 30
Default

Meiyen, could you explain why you mentioned "moment generation function" in your proof? How did you get them? Are they useful for proving the result? since I think the proof is good even without it... Thanks
Reply With Quote
  #4  
Old 03-07-2011, 02:35 PM
meiyen.chen meiyen.chen is offline
Member
 
Join Date: Jan 2011
Posts: 33
Default Correction of my code

Thanks for pointing out the bug in my code. I have corrected it and re-submit the corrected version of answer. In addition, I've done the Bonferroni correction and it detected these 6 data points that may be impostered:

495
1002
1003
1004
1005
1007
Attached Images
File Type: pdf ChenMY_hw5.pdf (85.6 KB, 377 views)
Attached Files
File Type: txt hw5_code.txt (1.2 KB, 388 views)
File Type: txt hw5Problem2.txt (69 Bytes, 388 views)
Reply With Quote
  #5  
Old 03-07-2011, 02:41 PM
meiyen.chen meiyen.chen is offline
Member
 
Join Date: Jan 2011
Posts: 33
Default

I was thinking to use the moment generation function to prove that the sum of y^2 is a chi-square distribution with N degree of freedom since the function is unique for every distribution.... That's why I included it.


Quote:
Originally Posted by xwang View Post
Meiyen, could you explain why you mentioned "moment generation function" in your proof? How did you get them? Are they useful for proving the result? since I think the proof is good even without it... Thanks
Reply With Quote
  #6  
Old 03-07-2011, 04:25 PM
xwang xwang is offline
Member
 
Join Date: Jan 2011
Posts: 30
Default

Oh, I see what you tried to say is slide 8 and 9 in lecture 10, proof for the "statistic" chi-square is distributed as Chisquare. Thanks for reminding me this...

But there is a mistake in stating that "squared normal random variable is distributed as Chisquare". I mean, the "statistic" chi-square is the sum of squares of n independent t-values, instead of the random variables. i.e. here y_i should be seen as t-value of y_i since it's from N(0,1).

Quote:
Originally Posted by meiyen.chen View Post
I was thinking to use the moment generation function to prove that the sum of y^2 is a chi-square distribution with N degree of freedom since the function is unique for every distribution.... That's why I included it.
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 03:30 PM.


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