anova

2-way anova on unbalanced dataset

随声附和 提交于 2019-12-04 09:32:16
问题 Is aov appropriate for unbalanced datasets. According to help ...provides a wrapper to lm for fitting linear models to balanced or unbalanced experimental designs . But later on it says aov is designed for balanced designs, and the results can be hard to interpret without balance . How should I perform a 2-way anova on an unbalanced dataset in R? I would like to reproduce the different results for type I and type III sum of squares of SAS output (when using proc glm ). I remember we were

How can I classify post-hoc test results in R?

百般思念 提交于 2019-12-04 06:04:27
I am trying to understand how to work with ANOVAs and post-hoc tests in R. So far, I have used aov() and TukeyHSD() to analyse my data. Example: uni2.anova <- aov(Sum_Uni ~ Micro, data= uni2) uni2.anova Call: aov(formula = Sum_Uni ~ Micro, data = uni2) Terms: Micro Residuals Sum of Squares 0.04917262 0.00602925 Deg. of Freedom 15 48 Residual standard error: 0.01120756 Estimated effects may be unbalanced My problem is, now I have a huge list of pairwise comparisons but cannot do anything with it: TukeyHSD(uni2.anova) Tukey multiple comparisons of means 95% family-wise confidence level Fit: aov

Two Factor ANOVA Errorbar plot in R

柔情痞子 提交于 2019-12-03 18:01:29
We're teaching a stats class for biology students and trying to use R as the computing and data visualization platform. As much as possible, we'd like to avoid using extra packages and doing anything terribly "fancy" in R; the focus of the course is on the statistics, not the programming. Nevertheless, we haven't found a very good way of generating an errorbar plot in R for a two factor ANOVA design. We're using the ggplot2 package to make the plot, and while it does have a built-in stat_summary method of generating 95% CI errorbars, the way these are calculated may not always be the right way

Multiple t-test comparisons

本秂侑毒 提交于 2019-12-03 14:04:49
问题 I would like to know how I can use t.test or pairwise.t.test to make multiple comparisons between gene combinations. First, how can I compare all combinations Gene 1 vs. Gene 3, Gene 3 vs Gene 4, etc.? Second, how would I be able to only compare combinations of Gene 1 with the other genes? Do I need to make a function for this? Assuming I have the dataset below, when "arguments are not the same length", what can I do? Thanks. Gene S1 S2 S3 S4 S5 S6 S7 1 20000 12032 23948 2794 5870 782 699 3

ANOVA in python using pandas dataframe with statsmodels or scipy?

我只是一个虾纸丫 提交于 2019-12-03 11:35:37
问题 I want to use the Pandas dataframe to breakdown the variance in one variable. For example, if I have a column called 'Degrees', and I have this indexed for various dates, cities, and night vs. day, I want to find out what fraction of the variation in this series is coming from cross-sectional city variation, how much is coming from time series variation, and how much is coming from night vs. day. In Stata I would use Fixed effects and look at the R^2. Hopefully my question makes sense.

How to do one-way ANOVA in R with unequal sample sizes?

☆樱花仙子☆ 提交于 2019-12-03 09:29:01
问题 Trying to learn R. A question from an old stats text want's to know if there is a difference in break times at different construction sites. Trouble is, the text decided that each site employs a different number of workers. So, I am stuck and looking for help using ANOVA with unequal sample sizes. site1 <- c(34,25,27,31,26,34,21) site2 <- c(33,35,31,31,42,33) site3 <- c(17,30,30,26,32,28,26,29) site4 <- c(28,33,31,27,32,33,40) 回答1: Try this one site1 <- c(34,25,27,31,26,34,21) site2 <- c(33

Perform an ANOVA for each individual level of a factor in R

僤鯓⒐⒋嵵緔 提交于 2019-12-03 09:14:46
I am looking for a short and efficient method to run individual ANOVA analysis on each level of a factor. What I currently have, I think, is redundant and clutters the work space. Let's say I have the following: Letter Number Question A 1 1 A 2 1 A 3 1 B 1 1 B 2 1 B 3 1 C 1 1 C 2 1 C 3 1 I could run the following code to split the data frame into subsets A, B, and C: > list2env(split(data, data$Letter), globalenv()) > ANOVA.A <- aov(Question~Number, data=A) > ANOVA.B <- aov(Question~Number, data=B) > ANOVA.C <- aov(Question~Number, data=C) While this provides me with the required results, it

aov() error term in R: what's the difference bw Error(id) and Error(id/timevar) specification?

和自甴很熟 提交于 2019-12-03 07:22:44
问题 What is the difference between the aov(depvar~timevar+Error(id)) and the aov(depvar~timevar+Error(id/timevar)) formula specifications? These two variants produce slightly different results. The same question was once asked here: https://stats.stackexchange.com/questions/60108/how-to-write-the-error-term-in-repeated-measures-anova-in-r However, I'd like to repeat it with a more appropriate example. Here is an example that I created: var=rep(NA,180) id=rep(1:20,each=180/20) group=rep(rep(1:2

Custom contrasts in R: contrast coefficient matrix or contrast matrix / coding scheme? And how to get there?

杀马特。学长 韩版系。学妹 提交于 2019-12-03 06:52:21
Custom contrasts are very widely used in analyses, e.g.: "Do DV values at level 1 and level 3 of this three-level factor differ significantly?" Intuitively, this contrast is expressed in terms of cell means as: c(1,0,-1) One or more of these contrasts, bound as columns, form a contrast coefficient matrix, e.g. mat = matrix(ncol = 2, byrow = TRUE, data = c( 1, 0, 0, 1, -1, -1) ) [,1] [,2] [1,] 1 0 [2,] 0 1 [3,] -1 -1 However, when it comes to running these contrasts specified by the coefficient matrix, there is a lot of (apparently contradictory) information on the web and in books. My question

How to do one-way ANOVA in R with unequal sample sizes?

亡梦爱人 提交于 2019-12-03 02:57:50
Trying to learn R. A question from an old stats text want's to know if there is a difference in break times at different construction sites. Trouble is, the text decided that each site employs a different number of workers. So, I am stuck and looking for help using ANOVA with unequal sample sizes. site1 <- c(34,25,27,31,26,34,21) site2 <- c(33,35,31,31,42,33) site3 <- c(17,30,30,26,32,28,26,29) site4 <- c(28,33,31,27,32,33,40) Try this one site1 <- c(34,25,27,31,26,34,21) site2 <- c(33,35,31,31,42,33) site3 <- c(17,30,30,26,32,28,26,29) site4 <- c(28,33,31,27,32,33,40) Data <- data.frame( Y=c