Lectura de datos y depuracion
load("~/Dropbox/especialidad_nutricion/trabajos/trabajo 2/corazon.RData")
# $corazon<-read.csv('corazon.csv',sep=';')
head(corazon)
## N. SEXO EDAD edad.rec FUMA PAS PAS.rec PAD PAD.rec COLESTEROL
## 1 1 F 56 E4 NO 120 0 80 0 177
## 2 2 F 56 E4 NO 150 1 90 1 360
## 3 4 F 39 E2 NO 110 0 60 0 172
## 4 5 F 49 E3 NO 120 0 70 0 154
## 5 6 F 56 E4 NO 120 0 60 0 165
## 6 7 F 56 E4 NO 120 0 80 0 181
## COLESTEROL.rec TRIG TRIG.rec CCINTURA CCINTURA.rec
## 1 0 211 1 79 0
## 2 1 127 0 84 0
## 3 0 111 0 77 0
## 4 0 78 0 72,5 0
## 5 0 151 1 78 0
## 6 0 106 0 110 1
str(corazon)
## 'data.frame': 83 obs. of 15 variables:
## $ N. : int 1 2 4 5 6 7 8 9 10 12 ...
## $ SEXO : Factor w/ 2 levels "F","M": 1 1 1 1 1 1 1 1 1 1 ...
## $ EDAD : int 56 56 39 49 56 56 60 57 40 39 ...
## $ edad.rec : Factor w/ 4 levels "E1","E2","E3",..: 4 4 2 3 4 4 4 4 2 2 ...
## $ FUMA : Factor w/ 2 levels "NO","SI": 1 1 1 1 1 1 1 2 1 1 ...
## $ PAS : int 120 150 110 120 120 120 140 130 100 100 ...
## $ PAS.rec : Factor w/ 2 levels "0","1": 1 2 1 1 1 1 2 2 1 1 ...
## $ PAD : int 80 90 60 70 60 80 90 70 70 60 ...
## $ PAD.rec : Factor w/ 2 levels "0","1": 1 2 1 1 1 1 2 1 1 1 ...
## $ COLESTEROL : int 177 360 172 154 165 181 206 282 212 210 ...
## $ COLESTEROL.rec: Factor w/ 2 levels "0","1": 1 2 1 1 1 1 2 2 2 2 ...
## $ TRIG : Factor w/ 48 levels "101","103","106",..: 27 12 5 38 21 3 39 48 34 23 ...
## $ TRIG.rec : Factor w/ 2 levels "0","1": 2 1 1 1 2 1 1 2 2 2 ...
## $ CCINTURA : Factor w/ 53 levels "100","101","103",..: 26 33 24 20 25 8 31 52 18 27 ...
## $ CCINTURA.rec : Factor w/ 2 levels "0","1": 1 1 1 1 1 2 1 2 1 1 ...
names(corazon)
## [1] "N." "SEXO" "EDAD" "edad.rec"
## [5] "FUMA" "PAS" "PAS.rec" "PAD"
## [9] "PAD.rec" "COLESTEROL" "COLESTEROL.rec" "TRIG"
## [13] "TRIG.rec" "CCINTURA" "CCINTURA.rec"
colnames(corazon)[6] <- c("PAS")
colnames(corazon)[8] <- c("PAD")
colnames(corazon)[9] <- c("PAD.rec")
colnames(corazon)[12] <- c("TRIG")
colnames(corazon)[14] <- c("CCINTURA")
colnames(corazon)[15] <- c("CCINTURA.rec")
attach(corazon)
corazon$PAS.rec <- as.factor(corazon$PAS.rec)
corazon$PAD.rec <- as.factor(corazon$PAD.rec)
corazon$COLESTEROL.rec <- as.factor(corazon$COLESTEROL.rec)
corazon$TRIG.rec <- as.factor(corazon$TRIG.rec)
corazon$CCINTURA.rec <- as.factor(corazon$CCINTURA.rec)
DESCRIPCION
summary(corazon[, c(2, 4, 5, 7, 9, 11, 13, 15)])
## SEXO edad.rec FUMA PAS.rec PAD.rec COLESTEROL.rec TRIG.rec
## F:65 E1:13 NO:75 0:57 0:70 0:52 0:63
## M:18 E2:16 SI: 8 1:26 1:13 1:31 1:20
## E3:20
## E4:34
## CCINTURA.rec
## 0:52
## 1:31
##
##
1.CINTURA DE RIESGO Y SU ASOCIACIÓN CON SEXO Y EDAD.
addmargins(table(corazon$CCINTURA.rec, corazon$SEXO))
##
## F M Sum
## 0 39 13 52
## 1 26 5 31
## Sum 65 18 83
chisq.test(table(corazon$CCINTURA.rec, corazon$SEXO))
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: table(corazon$CCINTURA.rec, corazon$SEXO)
## X-squared = 0.4534, df = 1, p-value = 0.5007
fisher.test(table(corazon$CCINTURA.rec, corazon$SEXO))
##
## Fisher's Exact Test for Count Data
##
## data: table(corazon$CCINTURA.rec, corazon$SEXO)
## p-value = 0.417
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.1443 2.0038
## sample estimates:
## odds ratio
## 0.5806
addmargins(table(corazon$edad.rec, corazon$CCINTURA.rec))
##
## 0 1 Sum
## E1 11 2 13
## E2 13 3 16
## E3 11 9 20
## E4 17 17 34
## Sum 52 31 83
chisq.test(table(corazon$edad.rec, corazon$CCINTURA.rec))
## Warning: Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: table(corazon$edad.rec, corazon$CCINTURA.rec)
## X-squared = 7.871, df = 3, p-value = 0.04875
2.CIRCUNFERENCIA DE RIESGO Y SU ASOCIACIÓN CON HIPERTENSIÓN ARTERIAL.
addmargins(table(corazon$PAS.rec, corazon$CCINTURA.rec))
##
## 0 1 Sum
## 0 38 19 57
## 1 14 12 26
## Sum 52 31 83
chisq.test(table(corazon$PAS.rec, corazon$CCINTURA.rec))
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: table(corazon$PAS.rec, corazon$CCINTURA.rec)
## X-squared = 0.7662, df = 1, p-value = 0.3814
fisher.test(table(corazon$PAS.rec, corazon$CCINTURA.rec))
##
## Fisher's Exact Test for Count Data
##
## data: table(corazon$PAS.rec, corazon$CCINTURA.rec)
## p-value = 0.3297
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.5931 4.8888
## sample estimates:
## odds ratio
## 1.703
addmargins(table(corazon$PAD.rec, corazon$CCINTURA.rec))
##
## 0 1 Sum
## 0 43 27 70
## 1 9 4 13
## Sum 52 31 83
chisq.test(table(corazon$PAD.rec, corazon$CCINTURA.rec))
## Warning: Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: table(corazon$PAD.rec, corazon$CCINTURA.rec)
## X-squared = 0.0492, df = 1, p-value = 0.8244
fisher.test(table(corazon$PAD.rec, corazon$CCINTURA.rec))
##
## Fisher's Exact Test for Count Data
##
## data: table(corazon$PAD.rec, corazon$CCINTURA.rec)
## p-value = 0.7583
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.1453 2.8655
## sample estimates:
## odds ratio
## 0.7107
3.CIRCUNFERENCIA DE RIESGO Y SU ASOCIACIÓN CON HIPERCOLESTEROLEMIA.
addmargins(table(corazon$COLESTEROL.rec, corazon$CCINTURA.rec))
##
## 0 1 Sum
## 0 36 16 52
## 1 16 15 31
## Sum 52 31 83
chisq.test(table(corazon$COLESTEROL.rec, corazon$CCINTURA.rec))
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: table(corazon$COLESTEROL.rec, corazon$CCINTURA.rec)
## X-squared = 1.878, df = 1, p-value = 0.1705
fisher.test(table(corazon$COLESTEROL.rec, corazon$CCINTURA.rec))
##
## Fisher's Exact Test for Count Data
##
## data: table(corazon$COLESTEROL.rec, corazon$CCINTURA.rec)
## p-value = 0.1589
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.7613 5.8238
## sample estimates:
## odds ratio
## 2.09
4.CIRCUNFERENCIA DE RIESGO Y SU ASOCIACIÓN CON HIPERTRIGLICERIDEMIA.
addmargins(table(corazon$TRIG.rec, corazon$CCINTURA.rec))
##
## 0 1 Sum
## 0 40 23 63
## 1 12 8 20
## Sum 52 31 83
chisq.test(table(corazon$TRIG.rec, corazon$CCINTURA.rec))
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: table(corazon$TRIG.rec, corazon$CCINTURA.rec)
## X-squared = 3e-04, df = 1, p-value = 0.9872
fisher.test(table(corazon$TRIG.rec, corazon$CCINTURA.rec))
##
## Fisher's Exact Test for Count Data
##
## data: table(corazon$TRIG.rec, corazon$CCINTURA.rec)
## p-value = 0.7959
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.3544 3.6258
## sample estimates:
## odds ratio
## 1.157
5.CIRCUNFERENCIA DE RIESGO Y SU ASOCIACIÓN CON FUMADORES.
addmargins(table(corazon$FUMA, corazon$CCINTURA.rec))
##
## 0 1 Sum
## NO 49 26 75
## SI 3 5 8
## Sum 52 31 83
chisq.test(table(corazon$FUMA, corazon$CCINTURA.rec))
## Warning: Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: table(corazon$FUMA, corazon$CCINTURA.rec)
## X-squared = 1.352, df = 1, p-value = 0.245
fisher.test(table(corazon$FUMA, corazon$CCINTURA.rec))
##
## Fisher's Exact Test for Count Data
##
## data: table(corazon$FUMA, corazon$CCINTURA.rec)
## p-value = 0.1427
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.5522 21.5169
## sample estimates:
## odds ratio
## 3.095
6.HIPERTENSIÓN ARTERIAL SEGÚN SEXO Y EDAD Y SI FUMA.
addmargins(table(corazon$SEXO, corazon$PAS.rec))
##
## 0 1 Sum
## F 47 18 65
## M 10 8 18
## Sum 57 26 83
chisq.test(table(corazon$SEXO, corazon$PAS.rec))
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: table(corazon$SEXO, corazon$PAS.rec)
## X-squared = 1.143, df = 1, p-value = 0.2851
addmargins(table(corazon$edad.rec, corazon$PAS.rec))
##
## 0 1 Sum
## E1 10 3 13
## E2 14 2 16
## E3 13 7 20
## E4 20 14 34
## Sum 57 26 83
chisq.test(table(corazon$edad.rec, corazon$PAS.rec))
## Warning: Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: table(corazon$edad.rec, corazon$PAS.rec)
## X-squared = 4.706, df = 3, p-value = 0.1946
addmargins(table(corazon$SEXO, corazon$PAD.rec))
##
## 0 1 Sum
## F 56 9 65
## M 14 4 18
## Sum 70 13 83
chisq.test(table(corazon$SEXO, corazon$PAD.rec))
## Warning: Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: table(corazon$SEXO, corazon$PAD.rec)
## X-squared = 0.2489, df = 1, p-value = 0.6179
addmargins(table(corazon$edad.rec, corazon$PAD.rec))
##
## 0 1 Sum
## E1 11 2 13
## E2 14 2 16
## E3 19 1 20
## E4 26 8 34
## Sum 70 13 83
chisq.test(table(corazon$edad.rec, corazon$PAD.rec))
## Warning: Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: table(corazon$edad.rec, corazon$PAD.rec)
## X-squared = 3.436, df = 3, p-value = 0.3291
addmargins(table(corazon$FUMA, corazon$PAS.rec))
##
## 0 1 Sum
## NO 56 19 75
## SI 1 7 8
## Sum 57 26 83
chisq.test(table(corazon$FUMA, corazon$PAS.rec))
## Warning: Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: table(corazon$FUMA, corazon$PAS.rec)
## X-squared = 10.26, df = 1, p-value = 0.001361
addmargins(table(corazon$FUMA, corazon$PAD.rec))
##
## 0 1 Sum
## NO 66 9 75
## SI 4 4 8
## Sum 70 13 83
chisq.test(table(corazon$FUMA, corazon$PAD.rec))
## Warning: Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: table(corazon$FUMA, corazon$PAD.rec)
## X-squared = 5.287, df = 1, p-value = 0.02148
7.HIPOCOLESTEROLEMIA SEGÚN SEXO Y EDAD Y SI FUMA.
addmargins(table(corazon$SEXO, corazon$COLESTEROL.rec))
##
## 0 1 Sum
## F 40 25 65
## M 12 6 18
## Sum 52 31 83
chisq.test(table(corazon$SEXO, corazon$COLESTEROL.rec))
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: table(corazon$SEXO, corazon$COLESTEROL.rec)
## X-squared = 0.0151, df = 1, p-value = 0.9023
addmargins(table(corazon$edad.rec, corazon$COLESTEROL.rec))
##
## 0 1 Sum
## E1 9 4 13
## E2 9 7 16
## E3 12 8 20
## E4 22 12 34
## Sum 52 31 83
chisq.test(table(corazon$edad.rec, corazon$COLESTEROL.rec))
## Warning: Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: table(corazon$edad.rec, corazon$COLESTEROL.rec)
## X-squared = 0.6421, df = 3, p-value = 0.8867
addmargins(table(corazon$FUMA, corazon$COLESTEROL.rec))
##
## 0 1 Sum
## NO 48 27 75
## SI 4 4 8
## Sum 52 31 83
chisq.test(table(corazon$FUMA, corazon$COLESTEROL.rec))
## Warning: Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: table(corazon$FUMA, corazon$COLESTEROL.rec)
## X-squared = 0.155, df = 1, p-value = 0.6938
8.HIPERTRGLICERIDEMIA SEGÚN SEXO Y EDAD Y SI FUMA.
addmargins(table(corazon$SEXO, corazon$TRIG.rec))
##
## 0 1 Sum
## F 49 16 65
## M 14 4 18
## Sum 63 20 83
chisq.test(table(corazon$SEXO, corazon$TRIG.rec))
## Warning: Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: table(corazon$SEXO, corazon$TRIG.rec)
## X-squared = 0, df = 1, p-value = 1
addmargins(table(corazon$edad.rec, corazon$TRIG.rec))
##
## 0 1 Sum
## E1 12 1 13
## E2 11 5 16
## E3 16 4 20
## E4 24 10 34
## Sum 63 20 83
chisq.test(table(corazon$edad.rec, corazon$TRIG.rec))
## Warning: Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: table(corazon$edad.rec, corazon$TRIG.rec)
## X-squared = 3.069, df = 3, p-value = 0.3811
addmargins(table(corazon$FUMA, corazon$TRIG.rec))
##
## 0 1 Sum
## NO 59 16 75
## SI 4 4 8
## Sum 63 20 83
chisq.test(table(corazon$FUMA, corazon$TRIG.rec))
## Warning: Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: table(corazon$FUMA, corazon$TRIG.rec)
## X-squared = 1.87, df = 1, p-value = 0.1715