This is a test version of Biostars. For the public version, visit https://www.biostars.org.
LM in R: One way anova, Linear regression and T-test

Hi all,

I have some data like this

Condition, dependent variable, independent variable

A 1,2,3,4,5,5,6... x and y

B 1,2,3,4,5,5,6... x and y

C 1,2,3,4,5,5,6... x and y

D 1,2,3,4,5,5,6... x and y

..... each condition for three times

For this data, I am interested in the difference between to categoreis x and y for each condition testing for each time separately (not repeated measure) . According to my understanding, I can use an independent t-test, one way anova with two factors or linear regression. I used the lm model in R, which is a linear regression method, but tutorials say it can also be called one-way anova. So am I right if I report results as one way anova?

Next, since I have the same condition for three times so for multiple testing correction options I have is either estimated marginal mean (emm) followed by Pairwise comparisons with FDR adjustment. Or direct per condition FDR correction across all time. I get more or less similar results with both, but not sure which one is most reasonable to justify or if I am missing anything major here. My stats knowledge is mostly from tutorials and vidoes so maybe I am completely off track. Would really appreciate any guidance.

Thanks

anova t-test linear-regression

1 answer

Hey MS,

I’m not a statistician, but I’m confused by your description. In one way anova, there is one categorical variable (which can have multiple levels) and one response variable. Based on the dataset you described, I’m not sure how it fits one way anova. What are those values - A ...D and x and y?

A 1,2,3,4,5,5,6... x and y

B 1,2,3,4,5,5,6... x and y

C 1,2,3,4,5,5,6... x and y

D 1,2,3,4,5,5,6... x and y

Here is a toy dataset for one way anova - the dataset has one IV (categorical, independent variable has 3 levels - group) and one DV (response, numerical variable - weight).

> PlantGrowth
   weight group
1    4.17  ctrl
2    5.58  ctrl
3    5.18  ctrl
4    6.11  ctrl
5    4.50  ctrl
6    4.61  ctrl
7    5.17  ctrl
8    4.53  ctrl
9    5.33  ctrl
10   5.14  ctrl
11   4.81  trt1
12   4.17  trt1
13   4.41  trt1
14   3.59  trt1
15   5.87  trt1
16   3.83  trt1
17   6.03  trt1
18   4.89  trt1
19   4.32  trt1
20   4.69  trt1
21   6.31  trt2
22   5.12  trt2
23   5.54  trt2
24   5.50  trt2
25   5.37  trt2
26   5.29  trt2
27   4.92  trt2
28   6.15  trt2
29   5.80  trt2
30   5.26  trt2

Below links may be informative to you.

https://lindeloev.github.io/tests-as-linear/

https://rcompanion.org/handbook/I_05.html

Log in to answer this question.