Are you interested in this only for simple one sample t-tests? Or do you need 
something for the more complicated cases (which lead to discussions about 
approximations to degrees of freedom, etc.)?

For the simple one sample, the test can be done as a one liner:

> pt( mean/(sd/sqrt(n)), n-1 )

Which is not that much more complicated than a modified t-test function would 
be:

> t.test.summary( mean, sd, n )

Using the pt function would then force the students to think about which tail 
they are computing the area for and whether the p-value needs to be multiplied 
by 2 (rather than just specifying an argument).

For the 2 sample case, I have in the past just simulated a dataset with the 
same means and standard deviations, then used this in place of the raw data, 
the mvrnorm function in the MASS package has an option to generate normal data 
with the exact mean and variance specified.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[email protected]
801.408.8111


> -----Original Message-----
> From: [email protected] [mailto:r-sig-teaching-
> [email protected]] On Behalf Of Byungchul Cha
> Sent: Monday, November 08, 2010 10:26 PM
> To: [email protected]
> Subject: [R-sig-teaching] t.test from summary of data
> 
> I am using R in my intro stat course, and, I myself is a R novice.
> 
> We use "Intro to the practice of statistics" by Moore, McCabe, Craig as
> textbook. Is there an option for the command "t.test" so that it can
> perform t-test from the summary of sample data (that is, sample mean,
> sample sd, and sample size), instead of the (raw) sample data? I've
> been looking to find a way to do so, but, I couldn't.
> 
> I believe it is possible to write codes to do this for my own use, but,
> I am just curious. Is there a pedagogical reason not to do so? This is
> a bit annoying when all the exercises problems in the book needs such a
> functionality, and I can't figure out how to do it in R, especially
> when many other major stat packages (including TI calculators) have
> that capability. What am I missing here?
> 
> --
> Byungchul Cha
> Muhlenberg College
> 
> _______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-teaching

_______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching

Reply via email to