theSubset <- data.frame( A=numeric(16), BDivC=numeric(16), theIndicator = numeric(16)) theSubset$A = (as.numeric(totalMetab[rownames(totalMetab) == "fructose_6_phosphate",])) theSubset$BDivC = (as.numeric(totalMetab[rownames(totalMetab) == "glycerol_3_phosphate",])) / (as.numeric(totalMetab[rownames(totalMetab) == "glycine",])) #theSubset$BDivC = (as.numeric(totalMetab[rownames(totalMetab) == "glycerol_3_phosphate",])) / (as.numeric(totalMetab[rownames(totalMetab) == "glycine",])) theSubset$JustB = (as.numeric(totalMetab[rownames(totalMetab) == "glycerol_3_phosphate",])) theSubset$JustC = (as.numeric(totalMetab[rownames(totalMetab) == "glycine",])) theSubset$A = log(theSubset$A) theSubset$BDivC = log(theSubset$BDivC) theSubset$theIndicator = c(0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1) theSubset$theIndicator <- factor(theSubset$theIndicator) plot(theSubset$BDivC,theSubset$A, pch=21, bg=c("red","green")[unclass(theSubset$theIndicator)], main="Fructose_6_Phosphate vs (G3P/Glycine)", xlab="G3P/Glycine", ylab="Fructose_6_Phosphate") theSubsetZeroes = theSubset[which(theSubset$theIndicator=="0"),] abline(lsfit(theSubsetZeroes$BDivC, theSubsetZeroes$A)$coefficients, col="red") theSubsetOnes = theSubset[which(theSubset$theIndicator=="1"),] abline(lsfit(theSubsetOnes$BDivC, theSubsetOnes$A)$coefficients, col="green") #dev.off() summary(lm(A ~ BDivC*theIndicator, data=theSubset)) summary(lm(A ~ BDivC*theIndicator + log(JustC)*theIndicator , data=theSubset)) summary(lm(BDivC ~ theIndicator*A, data=theSubset)) summary(lm(A ~ log(JustB)*theIndicator, data=theSubset)) summary(lm(A ~ log(JustC)*theIndicator, data=theSubset)) anova(lm(A ~ log(JustC)*log(JustB)*theIndicator, data=theSubset), lm(A ~ log(JustC) + log(JustB), data=theSubset))