Re: [R] T-test for loop

2010-05-06 Thread Dimitri Liakhovitski
Sounds like homework (you are not supposed to post homework-related questions here - read the guidelines). But anyway: nr.of.rejections=0 for(i in 1:1){ x=rnorm(10, 0.1, 1) result-t.test(x,alternative=greater,mu=0,conf.level=0.95)$p.value if(result0.05) nr.of.rejections =

Re: [R] T-test for loop

2010-05-06 Thread Joris Meys
Hehe, those homeworks. If you can explain this code to the professor, you surely passed. n -1 obs.rej.rate - sum(sapply(1:n,function(x){t.test(rnorm(10, 0.1, 1),alternative=greater,mu=0,conf.level=0.95)$p.value 0.05}))/n obs.rej.rate This could actually be another round of R-golf. Anybody

Re: [R] T-test for loop

2010-05-06 Thread Joris Meys
PS : level, you might want to consider stopping to spam the help-list. You're not making yourself popular by asking -in one day- 3 questions that can be solved by using Google and reading the introductions given on the R homepage. On Thu, May 6, 2010 at 5:57 PM, Joris Meys jorism...@gmail.com

Re: [R] T-test for loop

2010-05-06 Thread Greg Snow
-project.org; level Subject: Re: [R] T-test for loop Hehe, those homeworks. If you can explain this code to the professor, you surely passed. n -1 obs.rej.rate - sum(sapply(1:n,function(x){t.test(rnorm(10, 0.1, 1),alternative=greater,mu=0,conf.level=0.95)$p.value 0.05}))/n

Re: [R] T-test for loop

2010-05-06 Thread Joris Meys
[mailto:r-help-boun...@r- project.org] On Behalf Of Joris Meys Sent: Thursday, May 06, 2010 9:57 AM To: Dimitri Liakhovitski Cc: r-help@r-project.org; level Subject: Re: [R] T-test for loop Hehe, those homeworks. If you can explain this code to the professor, you surely passed. n

Re: [R] T-test for loop

2010-05-06 Thread David Winsemius
...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Joris Meys Sent: Thursday, May 06, 2010 9:57 AM To: Dimitri Liakhovitski Cc: r-help@r-project.org; level Subject: Re: [R] T-test for loop Hehe, those homeworks

Re: [R] T-test for loop

2010-05-06 Thread David Winsemius
Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Joris Meys Sent: Thursday, May 06, 2010 9:57 AM To: Dimitri Liakhovitski Cc: r-help@r-project.org; level Subject: Re: [R] T

[R] T-test for loop

2010-05-05 Thread level
I have been set a question which i understand statistically but my inability with R is preventing me from finishing it.. My question is that we to calculate the frequency of Type 1 errors starting with x = rnorm(10, 0.1, 1) then doing a t-test seeing whether you reject the null hypothesis