# ANOVA Using Continuous CDFs

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

#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))

}


Per the answer to this question, storing the variables into a matrix works.

VN_ANOVA<- function(A){

mean_of_means <- mean(colMeans(A))
n<- ncol(A)

LPM_ratio = numeric(0L)

#Continuous CDF for each variable from Mean of Means
for (i in 1:n){
LPM_ratio[i] <- LPM(1,mean_of_means,A[,i])/
(LPM(1,mean_of_means,A[,i])+UPM(1,mean_of_means,A[,i]))

#Continuous CDF Deviation from 0.5
}

#Certainty associated with samples

#Graphs
boxplot(A, las=2, xlab= "Means", horizontal = TRUE,
main="ANOVA", col=rainbow(n))

#For ANOVA Visualization
abline(v=mean_of_means,col="red",lwd=4)
text(mean_of_means,pos=4, .25,"Mean of means", col = "red")

return(c("Certainty of Same Population"=VN_ANOVA_rho))

}