Dear All, A problem almost taken from a textbook: I have two independent samples (which are both assumed to come from a normal distribution). The sample sizes are N1 and N2, the sample means are x1 and x2 and the sample standard deviations are s1 and s2 (the standard deviations are close). I would like to conduct a two sample t-test with equal variances at alpha=0.05 (and then remove the assumption of equal variances). I have come across several resources http://bit.ly/WKGuHV http://bit.ly/WKGwzG but the difference here is that I have access only to the N,x and s for the two samples, NOT to the results of every observation (i.e I know for instance N1 x1 and s1, but I do not have the corresponding list of N1 values). Many thanks for any suggestions. Best Regards Lorenzo
I haven't put too much thought into this (and this has nothing to do with R), but... You have sufficient statistics, and are assuming a normal distribution, therefore you can "recreate" the two samples using this information. Perhaps something like this: N1 <- 100 N2 <- 130 x1 <- 30 x2 <- 33 s1 <- 1.01 s2 <- 1.20 X1 <- rnorm(n=N1, mean=x1, sd=s1) X2 <- rnorm(n=N2, mean=x2, sd=s2) # then do a t.test t.test(X1, X2) Lorenzo Isella wrote> Dear All, > A problem almost taken from a textbook: I have two independent samples > (which are both assumed to come from a normal distribution). > The sample sizes are N1 and N2, the sample means are x1 and x2 and the > sample standard deviations are s1 and s2 (the standard deviations are > close). > I would like to conduct a two sample t-test with equal variances at > alpha=0.05 (and then remove the assumption of equal variances). > I have come across several resources > > http://bit.ly/WKGuHV > http://bit.ly/WKGwzG > > but the difference here is that I have access only to the N,x and s for > the two samples, NOT to the results of every observation (i.e I know for > instance N1 x1 and s1, but I do not have the corresponding list of N1 > values). > Many thanks for any suggestions. > Best Regards > > Lorenzo > > ______________________________________________> R-help@> 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.-- View this message in context: http://r.789695.n4.nabble.com/Comparing-the-Means-of-Two-Normal-Distributions-tp4650665p4650673.html Sent from the R help mailing list archive at Nabble.com.
You have all the information that you need to do the pooled t-test using the formula in many intro stats textbooks and probably on wikipedia as well, just plug your numbers into the formulas in the book (R can act as the calculator to make this easier). Or sometimes simpler (for the human, the computer does more work, but that is what it is for) is to do like chuck.01 suggests and simulate the data, however chuck.01 left out a step, you should make sure that the simulated data has the exact same mean and standard deviation as you provide, then the results will be the same as if you used the formula (other than possible slight rounding errors). Generate the 2 samples from normals with mean 0 and standard deviation 1, then use the scale function to make sure that the means are exactly 0 and standard deviations exactly 1. Now multiply by the proper standard deviation then add the appropriate mean, then use the t.test function to analyze. On Sat, Nov 24, 2012 at 11:28 AM, Lorenzo Isella <lorenzo.isella@gmail.com>wrote:> Dear All, > A problem almost taken from a textbook: I have two independent samples > (which are both assumed to come from a normal distribution). > The sample sizes are N1 and N2, the sample means are x1 and x2 and the > sample standard deviations are s1 and s2 (the standard deviations are > close). > I would like to conduct a two sample t-test with equal variances at > alpha=0.05 (and then remove the assumption of equal variances). > I have come across several resources > > http://bit.ly/WKGuHV > http://bit.ly/WKGwzG > > but the difference here is that I have access only to the N,x and s for > the two samples, NOT to the results of every observation (i.e I know for > instance N1 x1 and s1, but I do not have the corresponding list of N1 > values). > Many thanks for any suggestions. > Best Regards > > Lorenzo > > ______________________________**________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help> > PLEASE do read the posting guide http://www.R-project.org/** > posting-guide.html <http://www.R-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >-- Gregory (Greg) L. Snow Ph.D. 538280@gmail.com [[alternative HTML version deleted]]