Statistically speaking, what should we expect (I would like to say "expect", but this is a very specific term ;-))? Coefficients should be (0,1), and not "do not match." The covariance (X, Y) is considered proportional to the variance of X, and not vice versa. Since X has non-zero variance, there is no problem. Since the covariance is 0, the estimated coefficient for X should be 0. Thus, within the tolerance of the machine, this is the answer you get.
There is no statistical anomaly here. There may be a statistical misunderstanding. There is also the problem of machine tolerance, but a coefficient of the order of 1E-19 is very negligible, given the scale of the predictor and response values.
Update 1: A quick overview of simple linear regression can be found on this page on Wikipedia . The main thing to note is that Var(x)
is in the denominator Cov(x,y)
in the numerator. In this case, the numerator is 0, the denominator is non-zero, so there is no reason to expect a NaN
or NA
. However, one may ask why it is not the resulting coefficient for x
a 0
, and this is due to the numerical problems of the accuracy of QR decomposition.
source share