I am evaluating the percentage of natural area in a gradient that goes from one to ten kilometers, in some areas of study. However some areas are not large enough and do not cover all distances, therefore, in some distances it generated NAs. For this reason, my data does not fit to perform repeated measures ANOVA, that the most indicated for dependent variables or longitudinal analysis. But researching the literature, I found that the Generalized estimating equations (GEE) can handle missing values, but to use GEE need to know if the missing values are missing completely at random (MCAR).
I am trying to do these analyzes on R, however I am not able to understand the codes that I found on the internet, and the packages that make these analyzes generally have already inspired.
Replicable data set
dfr <- data.frame( ID= rep(seq (1, 60, 1), each = 10, times=60),
Name= rep(seq(1, 60, by=1),each = 10, times=60) %>% paste0("Area", "_", .),
Dist= rep(seq(1, 10, by=1), times=60)%>% paste0(. ,"km" ),natural=rnorm(600))
dfr <- dfr[order(dfr$Dist), ]
dfr$natural <- replace(dfr$natural, which(dfr$natural < 0), NA)
-
As I just want to know if the NAs are randomly distributed between the distances, I thought about creating a new column replacing the NAs with 0 and the proportion values with 1.
dfr$miss[dfr$natural < 0] <- 0 dfr$miss[dfr$natural > 0] <- 1 summary(glm(miss ~ Dist, data=dfr, family=binomial))
The code above works, but I don't know if it is correct to do so to evaluate the MCAR.
Aucun commentaire:
Enregistrer un commentaire