Here we predict the weight of a man from his height using linear regression from the following data in the table for men:
Height in cm |
Weight in kg |
180 |
75 |
174 |
71 |
184 |
83 |
168 |
63 |
178 |
70 |
172 |
? |
We would like to estimate the weight of a man given that his height is 172cm.
Analysis using R:
In the previous example Fahrenheit and Celsius conversion, the data fitted the linear model perfectly. Thus we could perform even a simple mathematical analysis (solving basic equations) to gain the conversion formula. Most of the data in the realworld does not fit a model perfectly. For such an analysis, it is good to find the model that fits the given data with the minimal error. We use R do find such a linear model.
Input:
We put the data from the table above into the vectors and try...