I have a procedure for conducting ANOVA, the details of which can be viewed in this white paper.
I would like to be able to make the routine scalable to handle any number of groups. Below is the R code for a 2 group example. Any insights or comments are appreciated.
Partial Moments:
LPM<- function(degree,target,variable){
sum((target - (variable[variable < target]))^degree)/length(variable)
}
UPM<- function(degree,target,variable){
sum(((variable[variable > target]) - target)^degree)/length(variable)
}
ANOVA:
VN_ANOVA<- function(group1,group2){
mean_of_means <- mean(c(mean(group1),mean(group2)))
#Continuous CDF for each group from Mean of Means
LPM_ratio_1 <- LPM(1,mean_of_means,group1)/
(LPM(1,mean_of_means,group1)+UPM(1,mean_of_means,group1))
LPM_ratio_2 <- LPM(1,mean_of_means,group2)/
(LPM(1,mean_of_means,group2)+UPM(1,mean_of_means,group2))
#Continuous CDF Deviation from 0.5
MAD_CDF<- mean(c(abs(LPM_ratio_1 - 0.5),abs(LPM_ratio_2 - 0.5)))
#Certainty associated with samples
VN_ANOVA_rho <- (0.5 - MAD_CDF)/0.5
#Graphs
boxplot(list(group1,group2), las=2, names=c("Group 1","Group 2"),
xlab= "Means", horizontal = TRUE,
col=c("grey","white"), main="ANOVA")
#For ANOVA Visualization
abline(v=mean_of_means,col="red",lwd=4)
text(mean_of_means,pos=4, 2.5, "Mean of means", col = "red")
return(c("Certainty of Same Population"=VN_ANOVA_rho))
}