You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
x | A vector, matrix, list or other object coercible to a matrix; the independent variable
y | A vector, matrix, list or other object coercible to a vector; the dependent variable
But, the results are opposite:
x = rnorm(100)
y = x * 2
RollingBeta(x = x, y = y, window = 50)
expected result 2 (as we have defined y = x*2), actual result: 0.5.
Hence definition of x and y is opposite.
This gives correct results:
RollingBeta(x = y, y = x, window = 50)
I wondered why tests pass. This is the result.
From unit tests:
From function definition:
But, the results are opposite:
expected result
2
(as we have defined y = x*2), actual result:0.5
.Hence definition of x and y is opposite.
This gives correct results:
I wondered why tests pass. This is the result.
From unit tests:
RollingWindow/tests/test.R
Line 65 in 6c3adda
Tests call it as
(x, y)
hencelhs = x
RollingWindow/tests/test.R
Line 249 in 6c3adda
The correct formula for simple linear regression is:
cov(x,y)/var(x)
Hence (note
var(lhs)
):The main culprit:
RollingWindow/src/RollingWindow.cpp
Line 552 in 6c3adda
Should be cov/var_x
The text was updated successfully, but these errors were encountered: