I have a code in R for linear regression of two interacting genotypes geno_A
and geno_B
. I have to implement the same thing in Java. I tried Apache Commons Math Library. However, I am unable to regress test_trait
neither on geno_A
and geno_B
nor on their interaction. I was only able to regress test_trait
on either geno_A
or geno_B
which really does not solve the problem. I also tried Weka, but the case was the same.
R Code:
test_trait <- c( -0.48812477 , 0.33458213, -0.52754476, -0.79863471, -0.68544309, -0.12970239, 0.02355622, -0.31890850,0.34725819 , 0.08108851)
geno_A <- c(1, 0, 1, 2, 0, 0, 1, 0, 1, 0)
geno_B <- c(0, 0, 0, 1, 1, 0, 0, 0, 0, 0)
fit <- lm(test_trait ~ geno_A*geno_B)
fit
I will greatly appreciate your help. Thanks in advance.
Thank you very much for your answer.
Do you have any idea, how can i calcualte Java equavalent of R code
anova(fit)
?I've never done it. But a quick google for ANOVA and java shows that there seems to be some libraries out there for doing it. For example this: http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/stat/inference/OneWayAnova.html Further than that I'm afraid I can't help.