Is it possible to use t.test() do t-test when I have only two means, sample size, two standard deviations ? (no raw data).
When you type 't.test.default', you get the source code of the t.test function.
If you are conducting a t.test with var.equal=T, paired=F, alternative=two.sided,
the following commands are executed:
df <- nx + ny - 2 v <- ((nx - 1) * vx + (ny - 1) * vy)/df stderr <- sqrt(v * (1/nx + 1/ny)) tstat <- (mx - my - mu)/stderr pval <- 2 * pt(-abs(tstat), df)
You could write your own function taking nx, mx, vx and ny, my and vy as args.
(vx=var(x))
my.t.test <- function (nx,mx,vx,ny,my,vy) { df <- nx + ny - 2 v <- ((nx - 1) * vx + (ny - 1) * vy)/df stderr <- sqrt(v * (1/nx + 1/ny)) tstat <- (mx - my)/stderr pval <- 2 * pt(-abs(tstat), df)
cat("df=",df) cat("\nT=",tstat) cat("\np=",pval) }
Christophe Pallier www.pallier.org
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html