Possible Duplicate:
Is there a Java library for better linear regression? (E.g., iteratively reweighted least squares)
I have a following code inf R, but i need to implement the same thing in java. I am not very sharp at maths, so need some help.
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 <- as.factor(c("Sub_0001"=1, "Sub_0002"=0, "Sub_0003"=1, "Sub_0004"=2, "Sub_0005"=0, "Sub_0006"=0, "Sub_0007"=1, "Sub_0008"=0, "Sub_0009"=1, "Sub_0010"=0))
geno_B <- as.factor(c("Sub_0001"=0, "Sub_0002"=0, "Sub_0003"=0, "Sub_0004"=1, "Sub_0005"=1, "Sub_0006"=0, "Sub_0007"=0, "Sub_0008"=0, "Sub_0009"=0, "Sub_0010"=0) )
fit <- lm(test_trait ~ geno_A*geno_B)
res <- anova(fit)
p.value <- res[3,5]
Edit 1: I had checked Apache Commons Math library before posting this question and checked Is there a Java library for better linear regression? (E.g., iteratively reweighted least squares) , but my problem is that i could not identify if my case is simple linear regression or multiple.
test_trait
contains height expressed from genetic trait geno_A
and geno_B
. geno_A
and geno_B
are alleles.