source("/Users/mauriciogutierrez/Library/Mobile Documents/com~apple~CloudDocs/estadisticas/general_functions_new.R")
## Loading required package: XLConnectJars
## XLConnect 0.2-11 by Mirai Solutions GmbH [aut],
## Martin Studer [cre],
## The Apache Software Foundation [ctb, cph] (Apache POI, Apache Commons
## Codec),
## Stephen Colebourne [ctb, cph] (Joda-Time Java library)
## http://www.mirai-solutions.com ,
## http://miraisolutions.wordpress.com
## Loading required package: reshape2
## Loading required package: stringr
data=readexcel("/Users/mauriciogutierrez/Library/Mobile Documents/com~apple~CloudDocs/estadisticas/Gabriela_Mintegui/incidentaloma.xlsx","Hoja1")
labelsexo=c("Femenino","Masculino")
labelimagendiagnostico=c("Eco","TAC","RNM")
labelmotivoimagen=c("Renal","Digestiva","Lumbalgia","Otros")
labellateralidad=c("Unilateral","Bilateral")
labeldicotomico=c("No","Si")
labelparaclinica=c("No","Si","No Solicitada","Pendiente")
#============================================================= Análisis Exploratorio
freq(data,data$sexo,labelsexo,using_na=T)



##
## absolute relative cumulative ici ics
## Femenino 32 76.19 76.19 60.55 87.95
## Masculino 10 23.81 100 12.05 39.45
## Total 42 100.00
means(data,data$edad_diagnostico)
##
## edad_diagnostico
## n 42
## Mean 57.88
## Median 58
## Sd 8.04
## Min 39
## Max 74
## Range 35
## Q1 52.25
## Q3 63
## Iqr 10.75
## Normality 0.968
## ICI 57.8
## SCI 57.96
## Summary Mean[ICI-ICS] --> 57.88(57.8-57.96)


freq(data,data$anio_diagnostico,pie=F,using_na=T)


##
## absolute relative cumulative ici ics
## 2005 3 7.14 7.14 1.5 19.48
## 2006 1 2.38 9.52 0.06 12.57
## 2007 1 2.38 11.9 0.06 12.57
## 2008 3 7.14 19.05 1.5 19.48
## 2009 3 7.14 26.19 1.5 19.48
## 2010 6 14.29 40.48 5.43 28.54
## 2011 5 11.9 52.38 3.98 25.63
## 2012 3 7.14 59.52 1.5 19.48
## 2013 4 9.52 69.05 2.66 22.62
## 2014 8 19.05 88.1 8.6 34.12
## 2015 5 11.9 100 3.98 25.63
## Total 42 100.00
freq(data,data$metodo_imagen_diagnostico,labelimagendiagnostico,using_na=T)



##
## absolute relative cumulative ici ics
## Eco 7 16.67 16.67 6.97 31.36
## TAC 32 76.19 92.86 60.55 87.95
## RNM 3 7.14 100 1.5 19.48
## Total 42 100.00
freq(data,data$motivo_imagen,labelmotivoimagen,using_na=T)



##
## absolute relative cumulative ici ics
## Renal 10 23.81 23.81 12.05 39.45
## Digestiva 20 47.62 71.43 32 63.58
## Lumbalgia 5 11.9 83.33 3.98 25.63
## Otros 7 16.67 100 6.97 31.36
## Total 42 100.00
freq(data,data$lateralidad,labellateralidad,using_na=T)



##
## absolute relative cumulative ici ics
## Unilateral 36 85.71 85.71 71.46 94.57
## Bilateral 6 14.29 100 5.43 28.54
## Total 42 100.00
means(data,data$tamanio_diagnostico)
##
## tamanio_diagnostico
## n 41
## Mean 21.3
## Median 18
## Sd 11.66
## Min 6
## Max 60
## Range 54
## Q1 13
## Q3 26
## Iqr 13
## Normality 0.001
## ICI 21.19
## SCI 21.42
## Summary Median[Q1-Q3] -->18(13-26)


freq(data,data$crecimiento_en_evolucion,labeldicotomico)



##
## absolute relative cumulative ici ics
## No 23 54.76 54.76 38.67 70.15
## Si 8 19.05 73.81 8.6 34.12
## Missing 11 26.19 100.00 13.86 42.04
## Total 31 100.00
crecieron=data[which(data$crecimiento_en_evolucion==1),]
means(crecieron,crecieron$crecimiento)
##
## crecimiento
## n 8
## Mean 6.25
## Median 5.5
## Sd 3.85
## Min 2
## Max 14
## Range 12
## Q1 3.75
## Q3 7.5
## Iqr 3.75
## Normality 0.403
## ICI 6.16
## SCI 6.34
## Summary Mean[ICI-ICS] --> 6.25(6.16-6.34)


freq(data,data$clu_diagnostico,labelparaclinica,using_na=T)



##
## absolute relative cumulative ici ics
## No 11 26.19 26.19 13.86 42.04
## Si 1 2.38 28.57 0.06 12.57
## No Solicitada 29 69.05 97.62 52.91 82.38
## Pendiente 1 2.38 100 0.06 12.57
## Total 42 100.00
freq(data,data$nugent_diagnostico,labelparaclinica,using_na=T)



##
## absolute relative cumulative ici ics
## No 30 71.43 71.43 55.42 84.28
## Si 5 11.9 83.33 3.98 25.63
## No Solicitada 3 7.14 90.48 1.5 19.48
## Pendiente 4 9.52 100 2.66 22.62
## Total 42 100.00
freq(data,data$cortisol_salival_diagnostico,c("No","Si","No Solicitada"),using_na=T)



##
## absolute relative cumulative ici ics
## No 2 4.76 4.76 0.58 16.16
## Si 2 4.76 9.52 0.58 16.16
## No Solicitada 38 90.48 100 77.38 97.34
## Total 42 100.00
freq(data,data$catecolaminas_diagnostico,c("No","Si","Pendiente"),using_na=T)



##
## absolute relative cumulative ici ics
## No 36 85.71 85.71 71.46 94.57
## Si 1 2.38 88.1 0.06 12.57
## Pendiente 5 11.9 100 3.98 25.63
## Total 42 100.00
freq(data,data$metanefrinas_urinarias_diagnostico,c("No","Si","No Solicitada"),using_na=T)



##
## absolute relative cumulative ici ics
## No 6 14.29 14.29 5.43 28.54
## Si 1 2.38 16.67 0.06 12.57
## No Solicitada 35 83.33 100 68.64 93.03
## Total 42 100.00
freq(data,data$aldosterona_diagnostico,labelparaclinica,using_na=T)



##
## absolute relative cumulative ici ics
## No 26 61.9 61.9 45.64 76.43
## Si 2 4.76 66.67 0.58 16.16
## No Solicitada 10 23.81 90.48 12.05 39.45
## Pendiente 4 9.52 100 2.66 22.62
## Total 42 100.00
freq(data,data$aldosterona_arp_diagnostico,labelparaclinica,using_na=T)



##
## absolute relative cumulative ici ics
## No 26 61.9 61.9 45.64 76.43
## Si 2 4.76 66.67 0.58 16.16
## No Solicitada 10 23.81 90.48 12.05 39.45
## Pendiente 4 9.52 100 2.66 22.62
## Total 42 100.00
freq(data,data$diagnostico_inicial,c("No Funcionante","Cushing Subclinico","Feocromocitoma","Otro"),using_na=T)



##
## absolute relative cumulative ici ics
## No Funcionante 31 73.81 73.81 57.96 86.14
## Cushing Subclinico 4 9.52 83.33 2.66 22.62
## Feocromocitoma 4 9.52 92.86 2.66 22.62
## Otro 3 7.14 100 1.5 19.48
## Total 42 100.00
nofuncionante=data[which(data$diagnostico_inicial==1),]
cushingsubclinico=data[which(data$diagnostico_inicial==3),]
feocromocitomas=data[which(data$diagnostico_inicial==4),]
otrosadenomas=data[which(data$diagnostico_inicial==8),]
freq(cushingsubclinico,cushingsubclinico$clu_diagnostico,c("No","No Solicitada","pendiente"),using_na=T)



##
## absolute relative cumulative ici ics
## No 2 50 50 6.76 93.24
## No Solicitada 1 25 75 0.63 80.59
## pendiente 1 25 100 0.63 80.59
## Total 4 100.00
freq(cushingsubclinico,cushingsubclinico$nugent_diagnostico,c("Si"),using_na=T)



##
## absolute relative cumulative ici ics
## Si 4 100 100 39.76 100
## Total 4 100.00
freq(cushingsubclinico,cushingsubclinico$cortisol_salival_diagnostico,c("Si","No solicitada"),using_na=T)



##
## absolute relative cumulative ici ics
## Si 2 50 50 6.76 93.24
## No solicitada 2 50 100 6.76 93.24
## Total 4 100.00
freq(feocromocitomas,feocromocitomas$catecolaminas_diagnostico,c("No","Si"),using_na=T)



##
## absolute relative cumulative ici ics
## No 3 75 75 19.41 99.37
## Si 1 25 100 0.63 80.59
## Total 4 100.00
freq(feocromocitomas,feocromocitomas$metanefrinas_urinarias_diagnostico,c("Si","No solicitada"),using_na=T)



##
## absolute relative cumulative ici ics
## Si 1 25 25 0.63 80.59
## No solicitada 3 75 100 19.41 99.37
## Total 4 100.00
freq(data,data$cirugia,labeldicotomico,using_na=T)



##
## absolute relative cumulative ici ics
## No 38 90.48 90.48 77.38 97.34
## Si 4 9.52 100 2.66 22.62
## Total 42 100.00
cirugia=data[which(data$cirugia==1),]
freq(cirugia,cirugia$via_cirugia,c("laparoscopica","laparotomia"),using_na=T)



##
## absolute relative cumulative ici ics
## laparoscopica 3 75 75 19.41 99.37
## laparotomia 1 25 100 0.63 80.59
## Total 4 100.00
freq(cirugia,cirugia$complicaciones_cirugia,labeldicotomico,using_na=T)



##
## absolute relative cumulative ici ics
## No 3 75 75 19.41 99.37
## Si 1 25 100 0.63 80.59
## Total 4 100.00
means(data,data$tiempo_seguimiento)
##
## tiempo_seguimiento
## n 42
## Mean 32.57
## Median 24
## Sd 26.83
## Min 0
## Max 108
## Range 108
## Q1 12
## Q3 57
## Iqr 45
## Normality 0.001
## ICI 32.31
## SCI 32.83
## Summary Median[Q1-Q3] -->24(12-57)


freq(data,data$hta,labeldicotomico,using_na=T)



##
## absolute relative cumulative ici ics
## No 11 26.19 26.19 13.86 42.04
## Si 31 73.81 100 57.96 86.14
## Total 42 100.00
freq(data,data$resonancia,labeldicotomico,using_na=T)



##
## absolute relative cumulative ici ics
## No 35 83.33 83.33 68.64 93.03
## Si 7 16.67 100 6.97 31.36
## Total 42 100.00
freq(data,data$housenfield,c("Menor o igual a 10","Entre 10 y 30","Mayor o igual a 30"))



##
## absolute relative cumulative ici ics
## Menor o igual a 10 17 40.48 40.48 25.63 56.72
## Entre 10 y 30 2 4.76 45.24 0.58 16.16
## Mayor o igual a 30 3 7.14 52.38 1.5 19.48
## Missing 20 47.62 100.00 32 63.58
## Total 22 100.00
freq(data,data$lavado,c("Menor a 50%","Mayor a 50%"))



##
## absolute relative cumulative ici ics
## Menor a 50% 2 4.76 4.76 0.58 16.16
## Mayor a 50% 6 14.29 19.05 5.43 28.54
## Missing 34 80.95 100.00 65.88 91.4
## Total 8 100.00
#============================================================= Análisis Inferencial
means(data,data$edad_diagnostico,data$diagnostico_inicial,c("No Funcionante","Cushing Subclinico","Feocromocitoma","Otro"))
##
## diagnostico_inicial = No Funcionante
## n 31
## Mean 58.35
## Median 59
## Sd 7.52
## Min 39
## Max 73
## Range 34
## Q1 53.5
## Q3 63.5
## Iqr 10
## Normal 0.936
## IIC 58.27
## ICS 58.44
## Summary2 58.35 (58.27-58.44)
## Summary Mean[ICI-ICS]
## Groups Homocedastics
## Normality Yes
## Differences No
## p-value 0.079
## Method ANOVA
## diagnostico_inicial = Cushing Subclinico
## n 4
## Mean 53.75
## Median 53.5
## Sd 5.32
## Min 48
## Max 60
## Range 12
## Q1 50.25
## Q3 57
## Iqr 6.75
## Normal 0.857
## IIC 53.57
## ICS 53.93
## Summary2 53.75 (53.57-53.93)
## Summary
## Groups
## Normality
## Differences
## p-value
## Method
## diagnostico_inicial = Feocromocitoma
## n 4
## Mean 52
## Median 50
## Sd 8.37
## Min 45
## Max 63
## Range 18
## Q1 45.75
## Q3 56.25
## Iqr 10.5
## Normal 0.402
## IIC 51.72
## ICS 52.28
## Summary2 52 (51.72-52.28)
## Summary
## Groups
## Normality
## Differences
## p-value
## Method
## diagnostico_inicial = Otro
## n 3
## Mean 66.33
## Median 71
## Sd 10.79
## Min 54
## Max 74
## Range 20
## Q1 62.5
## Q3 72.5
## Iqr 10
## Normal 0.266
## IIC 65.89
## ICS 66.77
## Summary2 66.33 (65.89-66.77)
## Summary
## Groups
## Normality
## Differences
## p-value
## Method

tables(data,data$diagnostico_inicial,data$lateralidad,labelx=c("No Funcionante","Cushing Subclinico","Feocromocitoma","Otro"),labely=labellateralidad)
##
## lateralidad
## diagnostico_inicial Unilateral Bilateral Sum
## No Funcionante 28 3 31
## Cushing Subclinico 1 3 4
## Feocromocitoma 4 0 4
## Otro 3 0 3
## Sum 36 6 42
##
## by Row (%)
## Unilateral Bilateral
## No Funcionante 90.32 9.67
## Cushing Subclinico 25.00 75.00
## Feocromocitoma 100.00 0.00
## Otro 100.00 0.00
## 85.71 14.28
##
## by Col (%)
## Unilateral Bilateral
## No Funcionante 77.77 50 73.80
## Cushing Subclinico 2.77 50 9.52
## Feocromocitoma 11.11 0 9.52
## Otro 8.33 0 7.14
##
## Fischer Test p = 0.023

means(data,data$tamanio_diagnostico,data$diagnostico_inicial,c("No Funcionante","Cushing Subclinico","Feocromocitoma","Otro"))
##
## diagnostico_inicial = No Funcionante
## n 31
## Mean 20
## Median 17
## Sd 9.9
## Min 6
## Max 46
## Range 40
## Q1 13.5
## Q3 24
## Iqr 10.5
## Normal 0.007
## IIC 19.89
## ICS 20.11
## Summary2 17 (13.5-24)
## Summary Median[Q1-Q3]
## Groups Homocedastics
## Normality No
## Differences Yes
## p-value 0.034
## Method Kruskal-Wallis
## diagnostico_inicial = Cushing Subclinico
## n 4
## Mean 16.88
## Median 17.25
## Sd 7.26
## Min 9
## Max 24
## Range 15
## Q1 11.62
## Q3 22.5
## Iqr 10.88
## Normal 0.4
## IIC 16.63
## ICS 17.12
## Summary2 17.25 (11.62-22.5)
## Summary
## Groups
## Normality
## Differences
## p-value
## Method
## diagnostico_inicial = Feocromocitoma
## n 4
## Mean 40
## Median 36
## Sd 14.7
## Min 28
## Max 60
## Range 32
## Q1 29.5
## Q3 46.5
## Iqr 17
## Normal 0.374
## IIC 39.5
## ICS 40.5
## Summary2 36 (29.5-46.5)
## Summary
## Groups
## Normality
## Differences
## p-value
## Method
## diagnostico_inicial = Otro
## n 2
## Mean 13
## Median 13
## Sd 4.24
## Min 10
## Max 16
## Range 6
## Q1 11.5
## Q3 14.5
## Iqr 3
## Normal -1
## IIC -1
## ICS -1
## Summary2 13 (11.5-14.5)
## Summary
## Groups
## Normality
## Differences
## p-value
## Method

tables(data,data$diagnostico_inicial,data$housenfield,labelx=c("No Funcionante","Cushing Subclinico","Feocromocitoma","Otro"),labely=c("Menor o igual a 10","Entre 10 y 30","Mayor o igual a 30"))
##
## housenfield
## diagnostico_inicial Menor o igual a 10 Entre 10 y 30 Mayor o igual a 30
## No Funcionante 14 1 2
## Cushing Subclinico 3 0 0
## Feocromocitoma 0 1 1
## Otro 0 0 0
## Sum 17 2 3
## housenfield
## diagnostico_inicial Sum
## No Funcionante 17
## Cushing Subclinico 3
## Feocromocitoma 2
## Otro 0
## Sum 22
##
## by Row (%)
## Menor o igual a 10 Entre 10 y 30 Mayor o igual a 30
## No Funcionante 82.35 5.88 11.76
## Cushing Subclinico 100.00 0.00 0.00
## Feocromocitoma 0.00 50.00 50.00
## Otro NaN NaN NaN
## 77.27 9.09 13.63
##
## by Col (%)
## Menor o igual a 10 Entre 10 y 30 Mayor o igual a 30
## No Funcionante 82.35 50 66.66
## Cushing Subclinico 17.64 0 0.00
## Feocromocitoma 0.00 50 33.33
## Otro 0.00 0 0.00
##
## No Funcionante 77.27
## Cushing Subclinico 13.63
## Feocromocitoma 9.09
## Otro 0.00
##
## Fischer Test p = 0.104

tables(data,data$diagnostico_inicial,data$lavado,labelx=c("No Funcionante","Cushing Subclinico","Feocromocitoma","Otro"),labely=c("Menor a 50%","Mayor a 50%"))
##
## lavado
## diagnostico_inicial Menor a 50% Mayor a 50% Sum
## No Funcionante 2 5 7
## Cushing Subclinico 0 0 0
## Feocromocitoma 0 1 1
## Otro 0 0 0
## Sum 2 6 8
##
## by Row (%)
## Menor a 50% Mayor a 50%
## No Funcionante 28.57 71.42
## Cushing Subclinico NaN NaN
## Feocromocitoma 0.00 100.00
## Otro NaN NaN
## 25.00 75.00
##
## by Col (%)
## Menor a 50% Mayor a 50%
## No Funcionante 100 83.33 87.5
## Cushing Subclinico 0 0.00 0.0
## Feocromocitoma 0 16.66 12.5
## Otro 0 0.00 0.0
##
## Fischer Test p > 0.999

tables(data,data$diagnostico_inicial,data$crecimiento_en_evolucion,labelx=c("No Funcionante","Cushing Subclinico","Feocromocitoma","Otro"),labely=labeldicotomico)
##
## crecimiento_en_evolucion
## diagnostico_inicial No Si Sum
## No Funcionante 20 5 25
## Cushing Subclinico 0 2 2
## Feocromocitoma 3 1 4
## Otro 0 0 0
## Sum 23 8 31
##
## by Row (%)
## No Si
## No Funcionante 80.00 20.0
## Cushing Subclinico 0.00 100.0
## Feocromocitoma 75.00 25.0
## Otro NaN NaN
## 74.19 25.8
##
## by Col (%)
## No Si
## No Funcionante 86.95 62.5 80.64
## Cushing Subclinico 0.00 25.0 6.45
## Feocromocitoma 13.04 12.5 12.90
## Otro 0.00 0.0 0.00
##
## Fischer Test p = 0.102

tables(data,data$diagnostico_inicial,data$cirugia,labelx=c("No Funcionante","Cushing Subclinico","Feocromocitoma","Otro"),labely=labeldicotomico)
##
## cirugia
## diagnostico_inicial No Si Sum
## No Funcionante 30 1 31
## Cushing Subclinico 4 0 4
## Feocromocitoma 1 3 4
## Otro 3 0 3
## Sum 38 4 42
##
## by Row (%)
## No Si
## No Funcionante 96.77 3.22
## Cushing Subclinico 100.00 0.00
## Feocromocitoma 25.00 75.00
## Otro 100.00 0.00
## 90.47 9.52
##
## by Col (%)
## No Si
## No Funcionante 78.94 25 73.80
## Cushing Subclinico 10.52 0 9.52
## Feocromocitoma 2.63 75 9.52
## Otro 7.89 0 7.14
##
## Fischer Test p = 0.005
