Questions tagged [anova]

ANOVA is an acronym for "analysis of variance". It is a widely used statistical technique to analyze the source of variance within a data set.

Overview

Although ANOVA stands for ANalysis Of VAriance, it is about comparing means of data from different groups. It is part of the general linear model which also includes linear regression and ANCOVA. In matrix algebra form, all three are:

Y=XB+e

Where Y is a vector of values for the dependent variable (these must be numeric), X is a matrix of values for the independent variables and e is error.

Tag usage

  • SO questions on ANOVA should be about implementation and programming problems, not about the statistical or theoretical properties of the technique.

  • Consider whether your question might be better suited to CrossValidated, the StackExchange site for statistics, machine learning and data analysis.

In scientific software for statistical computing and graphics, function aov implements ANOVA. Note that function anova does something else. See When should I use aov() and when anova()?

1456 questions
4
votes
2 answers

p-value matrix of x and y variables from anova output

I have many X and Y variables (something like, 500 x 500). The following just small data: yvars <- data.frame (Yv1 = rnorm(100, 5, 3), Y2 = rnorm (100, 6, 4), Yv3 = rnorm (100, 14, 3)) xvars <- data.frame (Xv1 = sample (c(1,0, -1), 100, replace =…
shNIL
  • 963
  • 10
  • 24
3
votes
1 answer

How to use grouped_ggwithinstats() function from ggstatsplot package correctly

I am trying to use grouped_ggwithinstats() function from ggstatsplot package: I have this data set: df <- structure(list(time = c(0L, 1L, 2L, 3L, 0L, 1L, 2L, 3L, 0L, 1L, 2L, 3L, 0L, 1L, 2L, 3L), group1 = c("A", "A", "A", "A", "B", "B", "B", "B",…
TarJae
  • 72,363
  • 6
  • 19
  • 66
3
votes
1 answer

Model simplification (two way ANOVA)

I am using ANOVA to analyse results from an experiment to see whether there are any effects of my explanatory variables (Heating and Dungfauna) on my response variable (Biomass). I started by looking at the main effects and interaction: full.model…
3
votes
5 answers

Is there a way to loop through column names (not numbers) in r for linear models?

I have a data sheet with 40 data columns (40 different nutrients), with additional columns for plot numbers and factors. I would like to automatically loop through each column name and produce a linear model and summary for each. The data columns…
Beth
  • 33
  • 3
3
votes
0 answers

annotate facet_grid plot with two-way ANOVA post-hoc results

I have a 2x2 study design (i.e. 4 groups) to test the interaction of two different interventions, and obtain multiple measurements for each subject, measured across different sites. I can nicely plot these data using a facet_grid for the different…
Timmo83
  • 119
  • 5
3
votes
2 answers

car::Anova in R gives different p-values for TypeII vs TypeIII even though I have a balanced design?

I have tried in vain to find the answer to this question in the other two way ANOVA discussions I have found, so I hope this isn't a repeat. I have a balanced design (5 observations in each of 4 groups). To my understanding, this means that…
jmorrr
  • 67
  • 8
3
votes
1 answer

Levene Test for Two-way ANOVA

I wanted to check the homogeneity of variance assumption for a two-way ANOVA. For that, I wanted to use the function leveneTest() in the car package. However, it gives me the error: Error in leveneTest.formula(formula, data, center = center) : …
Sandae
  • 33
  • 3
3
votes
2 answers

Anova in R: Dataframe selection

I just run into a problem when using a variable in the anova term. Normally I would use "AGE" directly in the term, but run it all in a loop so myvar will change. myvar=as.name("AGE") x=summary( aov (dat ~ contrasts*myvar)+ Error(ID/(contrasts)),…
Jasmine
  • 149
  • 3
  • 7
3
votes
1 answer

Tidy multiple anovas

I have tidy data, and followed the example here. Worked on my office computer, doesn't on my home computer. Now I get: Error in var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm) : is.atomic(x) is not TRUE In addition:…
Elk
  • 491
  • 2
  • 9
3
votes
0 answers

How to run hypothesis test with pandas data frame and specific conditions?

I am trying to run a hypothesis test using model ols. I am trying to do this model Ols for tweet count based on four groups that I have in my data frame. The four groups are Athletes, CEOs, Politicians, and Celebrities. I have the four groups each…
Noah Skole
  • 31
  • 2
3
votes
1 answer

Two Way Anova using Python

I am trying to do a two-way ANOVA, where I am trying to find the importance of two variables (B and M) on the classification of samples (given by the parameter C). I am trying to reshape the data frame to make it suitable for statsmodels package.…
Hrihaan
  • 275
  • 5
  • 21
3
votes
1 answer

Tukey HSD for categorical and continuous variables in R

I want to do a post-hoc test for a significant ANOVA I've done successfully. I have 5 conditions (target_onset) across which I want to compare reaction times (key_resp.rt) in a df called data_clean. target_onset and key_resp.rt are columns. This is…
anntree
  • 261
  • 3
  • 10
3
votes
1 answer

Compare Means (ANOVA) by groups in R using dplyr

I have aggregate summary results (N, mean, sd) for survey-questions for different subgroups (e.g. by course, age-group, gender). I would like to identify those subgroups where statistically significant entries exist to be then able to probe the…
3
votes
0 answers

Calculating between and within variance (mean squares) in mgcv::gam

I would like to calculate the between and within variability of a parametric term (or mean squares of parametric term and residuals) in a mgcv::gam, but can't figure out how to do that with mgcv. Below is an example. I've created a gam object. Then…
huang
  • 31
  • 4
3
votes
1 answer

create a table with looped anova results r

example of dataframe: > df ID B C D 1 A 1 1 3 2 B 2 3 1 3 C 1 1 1 4 D 3 1 1 5 E 1 0 0 I've looped anova on various variables on a dataframe with this code (found online) data:df library(car) LLA <- rep(NA, ncol…