This question already has an answer here:

This is probably a very basic question but I cannot find the answer after experimenting a lot with it. I am using the Davis dataset from https://vincentarelbundock.github.io/Rdatasets/datasets.html (Self-Reports of Height and Weight) from 200 individuals. The question that I am trying to answer is what weight is to be expected for a specific height. My first assumption here is that weight depends on height, so I am building my model using

model=lm(davis$weight~davis$height)

As far as I understand, the independent variable is on the right whereas the dependent is on the left, right? Now, the summary of the model is

Call:
lm(formula = davis$weight ~ davis$height)

Residuals:
    Min      1Q  Median      3Q     Max 
-19.658  -5.381  -0.555   4.807  42.894 

Coefficients:
               Estimate Std. Error t value Pr(>|t|)    
(Intercept)  -130.91040   11.52792  -11.36   <2e-16 ***
davis$height    1.15009    0.06749   17.04   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 8.505 on 198 degrees of freedom
Multiple R-squared:  0.5946,    Adjusted R-squared:  0.5925 
F-statistic: 290.4 on 1 and 198 DF,  p-value: < 2.2e-16

and I am assuming that I can calculate weight = (height*1.15009) -130.91040 So, assuming this is correct, I was approached by a colleague who said that height does not predict weight but vice versa. However, changing the model to

model=lm(davis$weight~davis$height)

gives me different results when I use the values of

> summary(model)

Call:
lm(formula = davis$height ~ davis$weight)

Residuals:
     Min       1Q   Median       3Q      Max 
-18.3492  -3.7151  -0.2466   3.5349  20.8802 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)  136.83054    2.02039   67.72   <2e-16 ***
davis$weight   0.51696    0.03034   17.04   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 5.702 on 198 degrees of freedom
Multiple R-squared:  0.5946,    Adjusted R-squared:  0.5925 
F-statistic: 290.4 on 1 and 198 DF,  p-value: < 2.2e-16

and calculate height = (weight*0.517) + 136.831. For example, according to the first model, a person with 190 centimeters is expected to weigh 87.6067 kilograms where when I enter these kilos into the second model, that person is expected to be about 182 centimeters tall. Any advice or a good book where I can really understand this? Thank you in advance!

marked as duplicate by whuber Jan 15 '17 at 21:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

migrated from stackoverflow.com Jan 15 '17 at 21:13

This question came from our site for professional and enthusiast programmers.

Browse other questions tagged or ask your own question.