Re: [R] T-test & for loop

2010-05-06 Thread David Winsemius
x27;)$p. < .05)) -- David -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center 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

Re: [R] T-test & for loop

2010-05-06 Thread David Winsemius
h.D. Statistical Data Center 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

Re: [R] T-test & for loop

2010-05-06 Thread Joris Meys
-- > David > > > >> -- >> Gregory (Greg) L. Snow Ph.D. >> Statistical Data Center >> Intermountain Healthcare >> greg.s...@imail.org >> 801.408.8111 >> >> >> -Original Message----- >>> From: r-help-boun...@r-project.o

Re: [R] T-test & for loop

2010-05-06 Thread Greg Snow
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 <-1 > obs.rej.rate <-

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 wrote: > Hehe, > > tho

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. Anybo

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(result<0.05) nr.of.rejections = nr.of

[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 (Ho