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
3 answers

Two Factor ANOVA Errorbar plot in R

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…
James Waters
  • 323
  • 1
  • 3
  • 9
4
votes
4 answers

Anova table with full model in one line in R

I am fitting a linear model in R with three variables like so cube_mod <- lm(y ~ x + x_2 + x_3) I then use the anova function to display the results of analysis of variance with and get the following table anova(cube_mod) Analysis of Variance…
spencergw
  • 157
  • 5
4
votes
2 answers

ANOVA with repeated measures and TukeyHSD post-hoc test in R

I would like to do Tukey HSD post hoc tests for a repeated measure ANOVA. The entered formula "TukeyHSD" returns me an error. I can't find the answer in the forum. Can I ask for help? "treat" is repeated measures factor, "vo2" is dependent…
alunats
  • 89
  • 5
4
votes
3 answers

Cannot run ANOVA to Compare Random Forest Models

I am using tidymodels to fit multiple Random Forest models. I then followed along with this tutorial to compare the model results. The problem is that I get the error: Error in UseMethod("anova") : no applicable method for 'anova' applied to an…
Adam_G
  • 7,337
  • 20
  • 86
  • 148
4
votes
1 answer

Summary Table (mean + std.error) with p-values for 2-way anova

I'm trying to make a table that outputs the summary statistics for a large study that we usually analyze by 2-way anova, looking at main effects of both variables as well as an interaction. I'd like a way to run the stats quickly, and output them in…
Erin Giles
  • 73
  • 6
4
votes
1 answer

Anova, for loop to apply function

>str(set) 'data.frame': 1000 obs. of 6 variables: $ ID : Factor .. $ a : Factor .. $ b: Factor .. $ c: Factor .. $ dat : num .. $ contrasts : Ord.factor .. >X [1] "a" "b" "c" for (i in 1 :length(X) ){ my=X[i] …
Jasmine
  • 149
  • 3
  • 7
4
votes
1 answer

Error: Can't subset columns that don't exist

I'm trying to do a mixed anova with 1 between- and 3 within-subjects factors. My data looks like the following: > head(rt_dat_allconds) # A tibble: 6 x 6 # Groups: participant, search_difficulty, cue_validity [3] participant search_difficulty…
anntree
  • 261
  • 3
  • 10
4
votes
2 answers

how to compare hierarchical regression models in python?

I fitted two regression models, One with only 1 predictor and the another with 3 predictors. Now I want to compare these two models. How can I do that? I know how to do it in R but not sure how to do it in python. Here is the code in R for…
bhola prasad
  • 675
  • 7
  • 22
4
votes
1 answer

aov and t.test deliver different results

From my knowledge, a t-test should deliver identical results (the same p-value) as ANOVA when applied to data with one explanatory variable. To test this, I ran the below to compare the results: df <- structure(list(y = c(1, 1, 1, 1, 1, 1, 2, 2, 1,…
DatamineR
  • 10,428
  • 3
  • 25
  • 45
4
votes
1 answer

"Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases" when doing 2-way repeated measures anova test

I've been trying to run a 2-Way repeated measures test on a dataset, with year & vaccine type being the independent variables and coverage being a dependent variable. I ran it with the code: sat = anova_test( data=SA, dv = coverage, wid = country,…
Dan
  • 61
  • 4
4
votes
1 answer

how to use anovascores results to eliminate columns/predictors with pvalues greater than 0.01

I had a dataset with 36400 columns/features/predictors (types of proteins) and 500 observations and the last column is response column "class" that indicates 2 types of cells - A and B. we're supposed to perform feature selection to reduce the…
Heena
  • 113
  • 1
  • 2
  • 6
4
votes
2 answers

How to get the four graphs generated from the regression analysis in R?

How to get the four graphs generated (one separated from the other/one at a time) from the regression analysis not by using the console / prompt (Hit to see next plot:)? if(!require("truncnorm")) install.packages("truncnorm") ;…
bbiasi
  • 1,549
  • 2
  • 15
  • 31
4
votes
1 answer

Difference between stats::anova and car::Anova in evaluating a linear mixed effect model from lme4

I'm learning more about the lme4 package and have appreciated both Bodo Winter's tutorial and this guide on Tufts. However, the two guides differ when suggesting a method to determine the significance of a fixed effect. Winters suggests using R's…
4
votes
1 answer

Understanding f_classif in sklearn

Recently to get best features I have used SelectKBest(score_func=, k=20). f_classif computes anova f-value between feature for classification tasks. I have used it and got best results. I learnt anova f-test computes ratio of 'between class…
Jyothi Kumar
  • 43
  • 10
4
votes
2 answers

Calling Matlab function from python: "initializer must be a rectangular nested sequence"

I am writing a python script from which I hope to call the Matlab anovan function. I have attempted a basic test of this feature on file test.txt, which contains 3 columns: 1.472008228227131532e+01 1.000000000000000000e+00…
crevell
  • 449
  • 6
  • 19