I have been trying to fit a linear regression on different sets of values and I found something a bit odd. Whenever I try to get a linear regression with the function rxLinMod(), oone of the coefficients gets dropped and whenever I use lm(), this doesn't happen.
The data set that was giving me some trouble is this one:
Dates | Values |
---|---|
2020-06-19 | 5950 |
2020-06-16 | 5950 |
After using rxLinMod, I get this:
rxLinMod(formula = Values ~ Dates, data = temp)
Rows Read: 2, Total Rows Processed: 2, Total Chunk Time: 0.001 seconds
Computation time: 0.006 seconds.
Call:
rxLinMod(formula = Values ~ Dates, data = temp)
Linear Regression Results for: Values ~ Dates
Data: temp
Dependent variable(s): Values
Total independent variables: 2 (Including number dropped: 1)
Number of valid observations: 2
Number of missing observations: 0
Coefficients:
Values
(Intercept) 5950
Dates Dropped
Meanwhile, lm() returns this:
Call:
lm(formula = Values ~ Dates, data = temp)
Coefficients:
(Intercept) Dates
5.950e+03 -1.829e-13
I already made sure that none of the variables are being treated as a factor, Date is of Date class, and Values is a numeric class. I was expecting a slope pretty close to 0. Does anyone have any idea of why is the coefficient being dropped in the first one?
If there is anything else you want to know, feel free to ask.