Hello everyone: I'm a new member of this group. I have a question about "oneway.test". When I use "anova(lm(....))" to analysis the ANOVA, I can get the information about Sum Sq and Mean Sq. (The R code and the results are as follows.) > anova(lm(BackCalac~factor(Assay),data=Control)) Analysis of Variance Table Response: BackCalac Df Sum Sq Mean Sq F value Pr(>F) factor(Assay) 4 270.846 67.711 56.219 1.345e-10 *** Residuals 20 24.088 1.204 But it default the variances are the same. If the variances aren't equal. I need to use the "oneway.test" method. Because oneway.test has the option about "var.equal=F". Here, I have a question about "oneway.test", How can I get "SS", and "MS" information from "oneway.test"? My R code and the results are as follows. Thank you very much. :)> oneway.test(BackCalac~factor(Assay), var.equal=T,data=Control)One-way analysis of means data: BackCalac and factor(Assay) F = 56.2191, num df = 4, denom df = 20, p-value = 1.345e-10> oneway.test(BackCalac~factor(Assay), var.equal=F,data=Control)One-way analysis of means (not assuming equal variances) data: BackCalac and factor(Assay) F = 92.8834, num df = 4.000, denom df = 9.625, p-value = 1.165e-07 -- View this message in context: http://r.789695.n4.nabble.com/How-to-get-the-SS-and-MS-from-oneway-test-tp4544417p4544417.html Sent from the R help mailing list archive at Nabble.com.
It is not clear to me how meaningful sums of squares and mean squares are in the context of oneway.test.(). Be that as it may, the short answer is you ***can't*** get at them from the output of oneway.test(). The oneway.test() function simply does not return enough information. If you ***really*** want/need (or think you do!) SS and MS information, you'll simply have to hack the code of oneway.test(). The code looks simple enough. I would advise reading the cited 1951 Biometrics paper by Welch in conjunction with your code-hacking. Good luck. cheers, Rolf Turner On 10/04/12 14:16, lulumecindy wrote:> Hello everyone: > I'm a new member of this group. > I have a question about "oneway.test". > When I use "anova(lm(....))" to analysis the > ANOVA, > I can get the information about Sum Sq and Mean > Sq. > (The R code and the results are as follows.) > > > anova(lm(BackCalac~factor(Assay),data=Control)) > Analysis of Variance Table > Response: BackCalac > Df Sum Sq Mean Sq F value Pr(>F) > factor(Assay) 4 270.846 67.711 56.219 1.345e-10 *** > Residuals 20 24.088 1.204 > > But it default the variances are the same. > If the variances aren't equal. I need to use the > "oneway.test" method. > Because oneway.test has the option about > "var.equal=F". > Here, I have a question about "oneway.test", > How can I get "SS", and "MS" information from > "oneway.test"? > My R code and the results are as follows. > Thank you very much. :) > >> oneway.test(BackCalac~factor(Assay), var.equal=T,data=Control) > One-way analysis of means > data: BackCalac and factor(Assay) > F = 56.2191, num df = 4, denom df = 20, p-value = 1.345e-10 >> oneway.test(BackCalac~factor(Assay), var.equal=F,data=Control) > One-way analysis of means (not assuming equal variances) > data: BackCalac and factor(Assay) > F = 92.8834, num df = 4.000, denom df = 9.625, p-value = 1.165e-07 > > > -- > View this message in context: http://r.789695.n4.nabble.com/How-to-get-the-SS-and-MS-from-oneway-test-tp4544417p4544417.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >
>From what I can see the function does not give back this information(either in the print output or the output object structure itself). The thing is that I have never studied the statistic used for this test, so I am not sure how it works and if giving the SS MS is meaningful or not. But if you want to dig in, simply write in R the command: oneway.test The code that seems to be relevant is near the end: } else { m <- sum(w.i * m.i)/sum.w.i STATISTIC <- sum(w.i * (m.i - m)^2)/((k - 1) * (1 + 2 * (k - 2) * tmp)) PARAMETER <- c(k - 1, 1/(3 * tmp)) PVAL <- pf(STATISTIC, k - 1, 1/(3 * tmp), lower.tail = FALSE) METHOD <- paste(METHOD, "(not assuming equal variances)") } So you could simply copy paste the full code of the function and edit it to extract this information... ----------------Contact Details:------------------------------------------------------- Contact me: Tal.Galili@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---------------------------------------------------------------------------------------------- On Tue, Apr 10, 2012 at 5:16 AM, lulumecindy <cindy852133@gmail.com> wrote:> Hello everyone: > I'm a new member of this group. > I have a question about "oneway.test". > When I use "anova(lm(....))" to analysis the > ANOVA, > I can get the information about Sum Sq and Mean > Sq. > (The R code and the results are as follows.) > > > anova(lm(BackCalac~factor(Assay),data=Control)) > Analysis of Variance Table > Response: BackCalac > Df Sum Sq Mean Sq F value Pr(>F) > factor(Assay) 4 270.846 67.711 56.219 1.345e-10 *** > Residuals 20 24.088 1.204 > > But it default the variances are the same. > If the variances aren't equal. I need to use the > "oneway.test" method. > Because oneway.test has the option about > "var.equal=F". > Here, I have a question about "oneway.test", > How can I get "SS", and "MS" information from > "oneway.test"? > My R code and the results are as follows. > Thank you very much. :) > > > oneway.test(BackCalac~factor(Assay), var.equal=T,data=Control) > One-way analysis of means > data: BackCalac and factor(Assay) > F = 56.2191, num df = 4, denom df = 20, p-value = 1.345e-10 > > oneway.test(BackCalac~factor(Assay), var.equal=F,data=Control) > One-way analysis of means (not assuming equal variances) > data: BackCalac and factor(Assay) > F = 92.8834, num df = 4.000, denom df = 9.625, p-value = 1.165e-07 > > > -- > View this message in context: > http://r.789695.n4.nabble.com/How-to-get-the-SS-and-MS-from-oneway-test-tp4544417p4544417.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >[[alternative HTML version deleted]]
OK! Thank you for your generous help. I'll try to change the code by myself. -- View this message in context: http://r.789695.n4.nabble.com/How-to-get-the-SS-and-MS-from-oneway-test-tp4544417p4544741.html Sent from the R help mailing list archive at Nabble.com.