Denis Kazakiewicz
2014-Sep-01 10:27 UTC
[R] Linear regression of 0/1 response ElemStatLearn (Fig. 2.1 the elements of statistical learning)
Hello In chapter 2 ESL book authors write: Let's look at example of linear model in a classification context They fit a simple linear model g = 0.3290614 -0.0226360x1 + 0.2495983x2 + e, where g is given with values 0 or 1. Then they made a decision boundary where yhat, if yhat>0.5 then yellow. Question: There is a separation line on the x1x2 plot. Where did intercept and slope for this line come from? In the ElemStatLearn R package, they simply put as abline( (0.5-coef(x.mod)[1] <http://i.stack.imgur.com/ANaTc.png>)/coef(x.mod)[3], -coef(x.mod)[2]/coef(x.mod)[3]), where first term is the intercept, and second term is slope for this line Regards Denis -------------- next part -------------- A non-text attachment was scrubbed... Name: ElemStatLearn.png Type: image/png Size: 115859 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20140901/bed7b4e1/attachment.png>
David L Carlson
2014-Sep-01 19:36 UTC
[R] Linear regression of 0/1 response ElemStatLearn (Fig. 2.1 the elements of statistical learning)
This is a list for R questions, not statistics or algebra, but if you set g=.5 and solve the linear model for x2 (ignore e), you will have your answer, eg: .5 = B1 + B2*X1 + B3*X2 where B1, 2, 3 are the three coefficients of the linear model, coef()[1], [2], [3]. ------------------------------------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Denis Kazakiewicz Sent: Monday, September 1, 2014 5:27 AM To: r-help at r-project.org Subject: [R] Linear regression of 0/1 response ElemStatLearn (Fig. 2.1 the elements of statistical learning) Hello In chapter 2 ESL book authors write: Let's look at example of linear model in a classification context They fit a simple linear model g = 0.3290614 -0.0226360x1 + 0.2495983x2 + e, where g is given with values 0 or 1. Then they made a decision boundary where yhat, if yhat>0.5 then yellow. Question: There is a separation line on the x1x2 plot. Where did intercept and slope for this line come from? In the ElemStatLearn R package, they simply put as abline( (0.5-coef(x.mod)[1] <http://i.stack.imgur.com/ANaTc.png>)/coef(x.mod)[3], -coef(x.mod)[2]/coef(x.mod)[3]), where first term is the intercept, and second term is slope for this line Regards Denis