[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-help
Subject:    [R] stats::lm has inconsistent output when adding constant to dependent variable
From:       "David J. Birke" <djbirke () berkeley ! edu>
Date:       2019-09-27 17:05:09
Message-ID: b4546e64-4105-fced-25f3-6103cfd3d7ee () berkeley ! edu
[Download RAW message or body]

Dear R community,

I just stumbled upon the following behavior in R version 3.6.0:

set.seed(42)
y <- rep(0, 30)
x <- rbinom(30, 1, prob = 0.91)
# The following will not show any t-statistic or p-value
summary(lm(y~x))
#  The following will show t-statistic and p-value
summary(lm(1+y~x))

My expected output is that the first case should report t-statistic and 
p-value. My intuition might be tricking me, but I think that a constant 
shift of the data should be fully absorbed by the constant and not 
affect inference about the slope.

Is this a bug or is there a reason why there should be a discrepancy 
between the two outputs?

Best,
David

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic