I need to do an ANOVA analysis between the proportions of natural area for some study areas that I am evaluating, however, I encountered a difficulty when evaluating my data.
My data set is extremely large but I will try to reproduce it with fictitious data here, so that you can better understand.
I have 80 study areas divided into two regions, totaling 40 areas for each region, within each region I have four categories totaling ten study areas for each category.
For each study area I have 11 buffers from 0 to 10 km away.
My data set has four predictor variables which are:
Region: with two levels (North, South)
Category: with four levels, (Category: A, B, C and D)
-areas: with 80 study areas
Distances: with 11 levels (distances ranging from 0 to 10
kilometers)
And as a Response variables:
- Proportion: with the proportion of natural area for each distance
I know that it would be necessary for me to do ANOVA of repeated measures but I am not able to do it, precisely because I have measures that are repeated within my sample units
I tried to do this, but I know it is wrong, because my distances from 0 to 10 are pseudo-replicas:
Reproducible example:
My_data<-data.frame(Area= rep(sprintf("area[%d]",seq(1,80, 1)),each=11),
Region = factor(rep(c("North","South"), each=440)),
Category= factor(rep(c("A","B", "C", "D"), each=11, times=20)),
Distances=factor(rep(c(seq(0,10,1)), times=80)),
Proportion= c(sample.int(101,size=880,replace=TRUE)-1)/1000)
Data Structure:
str(My_data)
'data.frame': 880 obs. of 5 variables:
$ Area : Factor w/ 80 levels "area[1]","area[10]",..: 1 1 1 1 1 1 1 1 1
1 ...
$ Region : Factor w/ 2 levels "North","South": 1 1 1 1 1 1 1 1 1 1 ...
$ Category : Factor w/ 4 levels "A","B","C","D": 1 1 1 1 1 1 1 1 1 1 ...
$ Distances : Factor w/ 11 levels "0","1","2","3",..: 1 2 3 4 5 6 7 8 9 10
...
$ Proportion: num 0.076 0.032 0.013 0.013 0.037 0.07 0.045 0.046 0.093
0.067 ...
library(stats)
modelo1<- aov ( Proportion ~ Category + Region * Distances, My_Data)
Anova(modelo1, type=3, test="F")
modelo2<- aov (Proportion ~ Category + Region + Distances, My_Data)
Anova(modelo2, type=3, test="F")
question from:
https://stackoverflow.com/questions/65925088/how-to-evaluate-anova-repeated-measures-in-r