#phan tích dữ liệu
t="D:\\van anh\\DU LIEU PT\\DATA FOR R.csv"
c0=read.csv(t)
head(c0)
## id TIME C..0.3.
## 1 1 0 3.2
## 2 2 0 5.0
## 3 3 0 2.7
## 4 4 0 3.2
## 5 5 1 4.5
## 6 6 1 7.2
#phân tích dữ liệu từ 0-3 tháng
hist(c0$C..0.3., breaks=20, col="blue", border="white")
# mô tả biến C0
library(DescTools)
Desc(c0$C..0.3.)
## -------------------------------------------------------------------------
## c0$C..0.3. (numeric)
##
## length n NAs unique 0s mean meanCI
## 1'205 1'205 0 185 0 7.74 7.49
## 100.0% 0.0% 0.0% 7.99
##
## .05 .10 .25 median .75 .90 .95
## 2.60 3.20 4.50 6.70 10.10 13.66 16.40
##
## range sd vcoef mad IQR skew kurt
## 29.80 4.43 0.57 3.85 5.60 1.30 2.10
##
## lowest : 1.4 (3), 1.5, 1.6 (4), 1.7 (3), 1.8 (5)
## highest: 24.8, 25.1, 27.2, 27.8, 31.2
# so sánh nồng độ theo khuyến cáo
c0$ss[c0$C..0.3.<10]="underthreshold"
c0$ss[c0$C..0.3.>15]="overthreshold"
c0$ss[c0$C..0.3.>=10&c0$C..0.3.<=15]="normal"
head(c0)
## id TIME C..0.3. ss
## 1 1 0 3.2 underthreshold
## 2 2 0 5.0 underthreshold
## 3 3 0 2.7 underthreshold
## 4 4 0 3.2 underthreshold
## 5 5 1 4.5 underthreshold
## 6 6 1 7.2 underthreshold
Desc(c0$ss)
## -------------------------------------------------------------------------
## c0$ss (character)
##
## length n NAs unique levels dupes
## 1'205 1'205 0 3 3 y
## 100.0% 0.0%
##
## level freq perc cumfreq cumperc
## 1 underthreshold 892 74.0% 892 74.0%
## 2 normal 226 18.8% 1'118 92.8%
## 3 overthreshold 87 7.2% 1'205 100.0%
#phân tích dữ liệu từ 3 đến 12 tháng
t= "D:\\van anh\\DU LIEU PT\\tu3 den 12 thang.csv"
cc=read.csv(t)
head(cc)
## ID time c2
## 1 1 3.33 5.7
## 2 2 4.33 7.2
## 3 3 5.33 10.7
## 4 4 6.27 7.7
## 5 5 7.30 4.2
## 6 6 8.30 6.1
hist(cc$c2, breaks =10, col = "blue", border = "white")
# mô tả biến cc
Desc(cc$c2)
## -------------------------------------------------------------------------
## cc$c2 (numeric)
##
## length n NAs unique 0s mean meanCI
## 807 807 0 122 0 6.89 6.70
## 100.0% 0.0% 0.0% 7.07
##
## .05 .10 .25 median .75 .90 .95
## 3.30 4.00 5.10 6.40 8.30 10.50 11.67
##
## range sd vcoef mad IQR skew kurt
## 20.00 2.63 0.38 2.22 3.20 1.05 1.96
##
## lowest : 1.6, 2.1, 2.3 (2), 2.4, 2.5 (2)
## highest: 15.9, 16.1, 17.4, 18.3, 21.6
# so sánh nồng độ theo khuyến cáo
cc$ss1[cc$c2<8]="underthreshold"
cc$ss1[cc$c2>12]="overthreshold"
cc$ss1[cc$c2>=8 & cc$c2<=12]="normal"
head(cc)
## ID time c2 ss1
## 1 1 3.33 5.7 underthreshold
## 2 2 4.33 7.2 underthreshold
## 3 3 5.33 10.7 normal
## 4 4 6.27 7.7 underthreshold
## 5 5 7.30 4.2 underthreshold
## 6 6 8.30 6.1 underthreshold
Desc(cc$ss)
## -------------------------------------------------------------------------
## cc$ss (character)
##
## length n NAs unique levels dupes
## 807 807 0 3 3 y
## 100.0% 0.0%
##
## level freq perc cumfreq cumperc
## 1 underthreshold 578 71.6% 578 71.6%
## 2 normal 194 24.0% 772 95.7%
## 3 overthreshold 35 4.3% 807 100.0%
#phân tích dữ liệu trên 1 năm
t="D:\\van anh\\DU LIEU PT\\tren 1 nam.csv"
cm=read.csv(t)
head(cm)
## ID Time C3
## 1 1 12.43 5.4
## 2 2 13.37 7.2
## 3 3 14.43 3.5
## 4 4 15.30 4.3
## 5 5 17.40 3.0
## 6 6 19.33 7.5
hist(cm$C3, breaks = 20, col = "blue", border = "white")
# mô tả biến C0
Desc(cm$C3)
## -------------------------------------------------------------------------
## cm$C3 (numeric)
##
## length n NAs unique 0s mean meanCI
## 1'027 1'027 0 117 0 6.14 5.95
## 100.0% 0.0% 0.0% 6.32
##
## .05 .10 .25 median .75 .90 .95
## 3.20 3.70 4.50 5.60 7.10 9.00 10.77
##
## range sd vcoef mad IQR skew kurt
## 70.00 3.10 0.50 1.93 2.60 9.52 186.42
##
## lowest : 1.0, 1.8, 1.9, 2.0 (2), 2.1 (3)
## highest: 14.8, 17.4, 17.8, 18.1, 71.0
# so sánh nồng độ theo khuyến cáo
cm$ss2[cm$C3<5]="underthreshold"
cm$ss2[cm$C3>10]="overthreshold"
cm$ss2[cm$C3>=5 & cm$C3<=10]="normal"
head(cm)
## ID Time C3 ss2
## 1 1 12.43 5.4 normal
## 2 2 13.37 7.2 normal
## 3 3 14.43 3.5 underthreshold
## 4 4 15.30 4.3 underthreshold
## 5 5 17.40 3.0 underthreshold
## 6 6 19.33 7.5 normal
Desc(cm$ss2)
## -------------------------------------------------------------------------
## cm$ss2 (character)
##
## length n NAs unique levels dupes
## 1'027 1'027 0 3 3 y
## 100.0% 0.0%
##
## level freq perc cumfreq cumperc
## 1 normal 586 57.1% 586 57.1%
## 2 underthreshold 375 36.5% 961 93.6%
## 3 overthreshold 66 6.4% 1'027 100.0%