Phân tích tương quan iu7ã BMNI và pcfat

Dữ liệu obesity data, Việt Nam

tac gia Henrydo

#Đọc dữ liệu vào RT

os <- read.csv("Osteo data.csv", header = TRUE)
head(os)
##   id lean.mass fat.mass pcfat age height weight  bmi osta osteo  osteo.group
## 1  1     27.98    16.49 37.09  76  156.0   45.0 18.5  6.2     2 Osteoporosis
## 2  8     29.02    27.54 48.70  54  153.0   56.0 23.9 -0.4     1   Osteopenia
## 3 21     31.72    20.65 39.43  56  158.2   51.5 20.6  0.9     1   Osteopenia
## 4 38     35.96    21.96 37.92  54  154.0   51.0 21.5  0.6     1   Osteopenia
## 5 39     35.00    26.29 42.89  60  159.5   60.0 23.6  0.0     1   Osteopenia
## 6 53     32.58    19.82 37.82  53  156.0   51.0 21.0  0.4     1   Osteopenia
os$Feet <- os$height*0.33
os$Pound <- os$weight*2.21
head(os)
##   id lean.mass fat.mass pcfat age height weight  bmi osta osteo  osteo.group
## 1  1     27.98    16.49 37.09  76  156.0   45.0 18.5  6.2     2 Osteoporosis
## 2  8     29.02    27.54 48.70  54  153.0   56.0 23.9 -0.4     1   Osteopenia
## 3 21     31.72    20.65 39.43  56  158.2   51.5 20.6  0.9     1   Osteopenia
## 4 38     35.96    21.96 37.92  54  154.0   51.0 21.5  0.6     1   Osteopenia
## 5 39     35.00    26.29 42.89  60  159.5   60.0 23.6  0.0     1   Osteopenia
## 6 53     32.58    19.82 37.82  53  156.0   51.0 21.0  0.4     1   Osteopenia
##     Feet   Pound
## 1 51.480  99.450
## 2 50.490 123.760
## 3 52.206 113.815
## 4 50.820 112.710
## 5 52.635 132.600
## 6 51.480 112.710
summary(lm(pcfat~bmi, data = os))
## 
## Call:
## lm(formula = pcfat ~ bmi, data = os)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -13.9528  -2.1885   0.3133   2.6410   8.1807 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 25.79338    1.51238   17.05   <2e-16 ***
## bmi          0.73140    0.06431   11.37   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.627 on 298 degrees of freedom
## Multiple R-squared:  0.3027, Adjusted R-squared:  0.3003 
## F-statistic: 129.3 on 1 and 298 DF,  p-value: < 2.2e-16

Về mối tương quan giữa BMI và pcfat

library(ggplot2)