[R] Beginner's question about t.test()

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sat Feb 14 19:54:08 CET 2004


"Pramote Khuwijitjaru" <kmote at hotmail.com> writes:

> Dear All,
> I am doing some exercise in statistics textbook on comparison of two
> experimental means. Is it possible to use t.test() do t-test when I
> have only two means, sample size, two standard deviations ? (no raw
> data).

Only if you "cheat".

fake.data <- function(n,mu,sigma) mu + sigma*scale(rnorm(n))
x1 <- fake.data(20, 12.345, .678)
x2 <- fake.data(20, 13.456, .789)
mean(x1)
sd(x1)
mean(x2)
sd(x2)

t.test(x1,x2)
-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list