I install the lm model
x <- c(0.1, 0.3, 0.2, 0.5, NA, 0.1, 0.8, 0.4)
y <- c(0.3, 0.2, 0.5, NA, 0.4, 0.5, 0.2, 0.4)
fit1<-lm(scale(y) ~ scale(x), na.action=na.omit)
summary(fit1)
This gives me a standard score of -0.593. When I use the cor function, it gives me a value of -0.577. If I multiplies the full cases of two vectors i.e.
x2 <- c(0.1, 0.3, 0.2, 0.1, 0.8, 0.4)
y2 <- c(0.3, 0.2, 0.5, 0.5, 0.2, 0.4)
and then install lm
fit2<-lm(scale(y2) ~ scale(x2))
summary(fit2)
the standardized score is the same as in the case of "cor" (- 0.577). I believe that the standard estimate and the correlation coefficient should be the same in a simple regression. The question is, what is the problem with fit1? (using "na.action = na.excluse" does not help).