I have a Df, the first column is phenotypic data and from the second to the last column is markers data. The rows are lines name.
pheno <- c(1450, 1700, 1300, 1333, 1545, 1755, 1100)
M1 <- c(0,2,0,0,0,0,2)
M2 <- c(2,2,2,2,0,0,2)
M3 <- c(0,0,0,0,0,2,0)
M4 <- c(0,0,2,2,2,2,0)
dd <- data.frame(pheno, M1, M2, M3, M4)
I want to run lm, so my code is:
fit <- lm(dd$pheno ~ ., data = dd)
I think that this code computes a regression of pheno over all other columns, but the coefficients for M1(and all other columns) are not the same when running a regression individually for each column
fit2 <- lm(dd$pheno ~ dd$M1, data = dd)
Any idea of what i could be doing wrong? Thanks in advance