filmov
tv
Intro to Statistical Learning (2nd Ed), Solution to Problem 3.12A (R and Python)

Показать описание
Question 3.12A
This problem involves simple linear regression without an intercept.
(a) Recall that the coefficient estimate β^ for the linear regression of Y onto X without an intercept is given by (3.38).
β^=∑ni=1xiyi∑ni=1x2i
Under what circumstance is the coefficient estimate for the regression of X onto Y the same as the coefficient estimate for the regression of Y onto X?
(b) Generate an example in R/Python with n = 100 observations in which the coefficient estimate for the regression of X onto Y is different from the coefficient estimate for the regression of Y onto X.
(c) Generate an example in R/Python with n = 100 observations in which the coefficient estimate for the regression of X onto Y is the same as the coefficient estimate for the regression of Y onto X.
This problem involves simple linear regression without an intercept.
(a) Recall that the coefficient estimate β^ for the linear regression of Y onto X without an intercept is given by (3.38).
β^=∑ni=1xiyi∑ni=1x2i
Under what circumstance is the coefficient estimate for the regression of X onto Y the same as the coefficient estimate for the regression of Y onto X?
(b) Generate an example in R/Python with n = 100 observations in which the coefficient estimate for the regression of X onto Y is different from the coefficient estimate for the regression of Y onto X.
(c) Generate an example in R/Python with n = 100 observations in which the coefficient estimate for the regression of X onto Y is the same as the coefficient estimate for the regression of Y onto X.