Peter and Moshe, thank you both for your suggestions and hints. I'm proud to say that it took me less than an hour to find my mistake: > s_pooled <- (((n-1)*(s_x^2)) + ((m-1)*(s_y^2))) / (n+m-2) > s_pooled [1] 1.939521 > t_obs <- (xbar - ybar) / (sqrt(s_pooled) * (sqrt(1/n + 1/m))) > t_obs [1] 2.15578 > qt(c(.025, .975), n+m-2) [1] -1.987934 1.987934 > # Therefore, reject H0 at the 0.05 level of significance.
Just to be clear about the 'homework' aspect of my questions: my homework is to work the problems out 'longhand' with just a calculator and printed tables. (In fact, 10 weeks into a 14 week course, we haven't been asked yet to use a computer.) I do this before I ask any questions regarding homework on this forum. On my own, I'm trying to answer some of the questions and examples in my textbook using R. My 'Homework help:' subject may have been misleading. I may change it to 'Extra-credit help:' to acknowledge the academic aspect of my question but distinguish it from my homework. I used 'Homework help:' because I didn't want anyone to suspect from the nature of the questions that I was trying to sneak in a homework question without acknowledging it. Thanks, again, for all your help for this statistics student. -Kevin -----Original Message----- From: Peter Dalgaard [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 07, 2007 6:50 PM To: Zembower, Kevin Cc: [EMAIL PROTECTED] Subject: Re: [R] Homework help: t test hypothesis testing with summarized data? Zembower, Kevin wrote: > Is this how a t hypothesis test is done when I don't have the actual > data, but just the summarized statistics: > >> #Homework 9.2.6 [1] >> n<-31 >> xbar<-3.10 >> s_x<-1.469 >> m<-57 >> ybar<-2.43 >> s_y<-1.35 >> s_pooled<- (((n-1)*s_x^2) + ((m-1)*s_y^2)) / (n + m - 2) >> s_pooled >> > [1] 1.939521 > >> t_obs <- (xbar - ybar) / (s_pooled * (sqrt(1/n + 1/m))) >> t_obs >> > [1] 1.547951 > >> qt(c(.025, .975), n+m-2) >> > [1] -1.987934 1.987934 > >> # Therefore, fail to reject H0 at the 0.05 level of significance >> >> > > Or am I again overlooking a canned procedure or an easier calculation > using the t distribution. > I don't know if someone told you last time, but there's an Internet code of honor about helping with homework.... Don't expect more than hints. You're on track but there's a mistake. Here's a way of testing your result: > x <- scale(rnorm(31))*1.469+3.10 > y <- scale(rnorm(57))*1.35+2.43 > t.test(x,y, var.equal=TRUE) > Thank you for your continued advice and help. > > -Kevin > > [1] An Introduction to Mathematical Statistics and its Applications, > fourth ed., Larsen and Marx. > > Kevin Zembower > Internet Services Group manager > Center for Communication Programs > Bloomberg School of Public Health > Johns Hopkins University > 111 Market Place, Suite 310 > Baltimore, Maryland 21202 > 410-659-6139 > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.