# How can I test significant differences across multiple categories in different dataframes?

I have very basic statistic knowledge and would like to hear some suggestions to analyze my data. I've three dataframes as displayed below:

dataset 1
Group.1     Moving   Feeding    Standing
1 cluster1 0.04863636 0.1268182 0.7993182
2 cluster2 0.05632530 0.1722892 0.7503012
3 cluster3 0.09220779 0.2644481 0.6118506

dataset2
Group.1     Moving   Feeding  Standing
1 cluster1 0.03750000 0.1462121 0.7922980
2 cluster2 0.04978355 0.1470238 0.7795848
3 cluster3 0.08214286 0.3216518 0.5642857

dataset3
Group.1     Moving    Feeding  Standing
1 cluster1 0.07052469 0.1273148 0.7875000
2 cluster2 0.08409091 0.1659091 0.7293706
3 cluster3 0.06950000 0.3496667 0.5476667


I would like to test wether values on cluster 1 row in dataset 1 are statistically different from cluster 1 in dataset 2 and dataset 3. I would like to apply the same information to cluster 2 and cluster 3 for all three datasets.

Is an ANOVA the right test to provide me such information? Maybe multiple t-tests?

Any input is appreciated!

• ANOVA stands for analysis of variance because they analyse the within group variance as compared to the between group variance. This means tests like ANOVAs require there to be multiple observations for each group. What that means is that you need to have multiple rows in the Group.1 column with the value cluster1 in each dataset for you to be able to test if there are differences between the datasets. Do you have more data? Mar 25, 2019 at 3:01
• @André.B Yes indeed, this are just average tables of full datasets. I've three different levels (cluster1, cluster2 and cluster3) that are based on three different categories (Moving,Feeding,Standing). Therefore, is this what you call a Multi-Way ANOVA instead? Mar 26, 2019 at 12:30
• How did you get on @juansalix? Apr 9, 2019 at 2:38

I think to begin with you want to change the shape of your dataset(s), as this will make it much easier to analyse. In this case I would enter the data into long format; Hadley Wickham has a good paper on this here. To combine the datasets you could carry out something like the following:

df1$$dataSet <- "Dataset 1" #The top three lines retain the information about dataset df2$$dataSet <- "Dataset 2"
df3\$dataSet <- "Dataset 3"
combine.df <- tidyverse::bind_rows(df1,df2,df3) #This line forms a single dataset


If you provide a easily reproducible dataset then it is a lot easier to help (see this link).

From the sounds of it, and please correct me if I am wrong, you want to test to see if a given cluster is different between datasets across three continuous numeric response variables.

If this is the case then what I would do is to fit a multivariate analysis of variance (MANOVA) to each cluster. What this will do is simultaneously test across all three response variables (Moving, Feeding, Standing) allowing you to control for type I error in a given test. However, you would need to conduct three separate MANOVA's - one for each cluster. Each of these would have the form like:

1. clust1.man <- manova(cbind(Moving, Feeding, Standing) ~ dataset, subset(combine.df, Group.1 == "cluster1)
2. clust2.man <- manova(cbind(Moving, Feeding, Standing) ~ dataset, subset(combine.df, Group.1 == "cluster2)
3. clust3.man <- manova(cbind(Moving, Feeding, Standing) ~ dataset, subset(combine.df, Group.1 == "cluster3)

After this you could control for type 1 error across your three significance tests as well - something like false discovery rate (FDR) might work quite well, as you can even do it by hand.

Let me know how you get on and if you hit any walls.