Felipe Maldonado
library(tidyverse)
[30m── [1mAttaching packages[22m ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──[39m
[30m[32m✔[30m [34mggplot2[30m 3.0.0 [32m✔[30m [34mpurrr [30m 0.2.5
[32m✔[30m [34mtibble [30m 1.4.2 [32m✔[30m [34mdplyr [30m 0.7.6
[32m✔[30m [34mtidyr [30m 0.8.1 [32m✔[30m [34mstringr[30m 1.3.1
[32m✔[30m [34mreadr [30m 1.1.1 [32m✔[30m [34mforcats[30m 0.3.0[39m
[30m── [1mConflicts[22m ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
[31m✖[30m [34mdplyr[30m::[32mfilter()[30m masks [34mstats[30m::filter()
[31m✖[30m [34mdplyr[30m::[32mlag()[30m masks [34mstats[30m::lag()[39m
concordancia <- read_csv("https://docs.google.com/spreadsheets/d/e/2PACX-1vRx7CiRoOuuyLcCngFADsks_1_Qn8Hyrjdruz3XoB4jJ0oogdjJu9iJPrj_R5B5a58dQFreGvOtmy3h/pub?gid=1894009846&single=true&output=csv")
Parsed with column specification:
cols(
`Marca temporal` = col_character(),
`N° Cuestionario` = col_integer(),
`Años de ejercicio profesional` = col_integer(),
Sexo = col_character(),
`Nivel de Estudios` = col_character(),
`Cantidad Promedio de Implantes Mensuales` = col_integer(),
`Cantidad aproximada de implantes instalados` = col_integer(),
`M1 Grosor V-P` = col_double(),
`M1 Distacia MD` = col_double(),
`M1 Altura ósea` = col_double(),
`M2 Grosor V-P` = col_double(),
`M2 Distancia M-D` = col_double(),
`M2 Altura ósea` = col_double()
)
concordancia <- janitor::clean_names(concordancia)
summary(concordancia)
marca_temporal n_cuestionario anos_de_ejercicio_profesional sexo nivel_de_estudios cantidad_promedio_de_implantes_mensuales
Length:32 Min. : 1.00 Min. : 2.00 Length:32 Length:32 Min. : 1.000
Class :character 1st Qu.: 8.75 1st Qu.: 7.00 Class :character Class :character 1st Qu.: 4.000
Mode :character Median :16.50 Median :10.50 Mode :character Mode :character Median : 6.000
Mean :16.47 Mean :11.16 Mean : 7.156
3rd Qu.:24.00 3rd Qu.:14.00 3rd Qu.: 8.000
Max. :32.00 Max. :24.00 Max. :30.000
cantidad_aproximada_de_implantes_instalados m1_grosor_v_p m1_distacia_md m1_altura_osea m2_grosor_v_p m2_distancia_m_d m2_altura_osea
Min. : 20.0 Min. :3.500 Min. : 8.280 Min. :11.06 Min. :4.150 Min. : 7.81 Min. :11.14
1st Qu.: 50.0 1st Qu.:4.378 1st Qu.: 9.848 1st Qu.:13.96 1st Qu.:4.388 1st Qu.:10.04 1st Qu.:13.54
Median : 150.0 Median :4.565 Median :10.955 Median :14.53 Median :4.540 Median :11.13 Median :14.52
Mean : 363.4 Mean :4.578 Mean :10.959 Mean :14.55 Mean :4.575 Mean :11.09 Mean :14.35
3rd Qu.: 400.0 3rd Qu.:4.827 3rd Qu.:12.098 3rd Qu.:15.22 3rd Qu.:4.670 3rd Qu.:12.24 3rd Qu.:15.07
Max. :4000.0 Max. :5.650 Max. :13.860 Max. :17.25 Max. :5.600 Max. :13.78 Max. :17.31
concordancia %>%
ggplot(aes(x = sexo)) +
geom_bar()
concordancia %>%
ggplot(aes(x = anos_de_ejercicio_profesional)) +
geom_histogram(bins = 5)
concordancia %>%
ggplot(aes(x = nivel_de_estudios)) +
geom_bar()
install.packages("BlandAltmanLeh")
Installing package into ‘/home/sergio/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
probando la URL 'https://cloud.r-project.org/src/contrib/BlandAltmanLeh_0.3.1.tar.gz'
Content type 'application/x-gzip' length 387698 bytes (378 KB)
==================================================
downloaded 378 KB
* installing *source* package ‘BlandAltmanLeh’ ...
** package ‘BlandAltmanLeh’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (BlandAltmanLeh)
The downloaded source packages are in
‘/tmp/RtmpAZWOwl/downloaded_packages’
library(BlandAltmanLeh)
bland.altman.plot(concordancia$m1_grosor_v_p, concordancia$m2_grosor_v_p,
graph.sys = "ggplot2")
NA
bland.altman.plot(concordancia$m1_distacia_md , concordancia$m2_distancia_m_d ,
graph.sys = "ggplot2")
bland.altman.plot(concordancia$m1_altura_osea , concordancia$m2_altura_osea ,
graph.sys = "ggplot2")
concordancia <- concordancia %>%
mutate(grosor = m1_grosor_v_p - m2_grosor_v_p) %>%
mutate(distancia = m1_distacia_md - m2_distancia_m_d) %>%
mutate(altura = m1_altura_osea - m2_altura_osea)
concordancia %>%
gather(key = "variable", value = "valor", grosor:altura) %>%
ggplot(aes(x = variable, y = valor)) +
geom_boxplot()
concordancia %>%
gather(key = "variable", value = "valor", grosor:altura) %>%
ggplot(aes(x = cantidad_promedio_de_implantes_mensuales, y = valor,
color = variable)) +
geom_point() +
geom_smooth() +
scale_x_log10()
concordancia %>%
gather(key = "variable", value = "valor", grosor:altura) %>%
ggplot(aes(x = valor)) +
geom_histogram(bins = 7) +
facet_grid(variable~sexo)
concordancia %>%
ggplot(aes(x = anos_de_ejercicio_profesional, y = cantidad_promedio_de_implantes_mensuales)) +
geom_point() +
geom_smooth() +
scale_y_log10()
concordancia %>%
gather(key = "variable", value = "valor", grosor:altura) %>%
ggplot(aes(x = cantidad_promedio_de_implantes_mensuales ,
y = valor,
color = variable)) +
geom_jitter(alpha = 0.6)
concordancia_long <- concordancia %>%
select(c(n_cuestionario,
anos_de_ejercicio_profesional,
sexo,
nivel_de_estudios,
cantidad_aproximada_de_implantes_instalados,
cantidad_promedio_de_implantes_mensuales,
grosor:altura)) %>%
gather(key = "variable", value = "valor", grosor:altura)
Agrego valor como abs
concordancia_long <- mutate(concordancia_long, valor_abs = abs(valor))
concordancia_long %>%
ggplot(aes(x = valor)) +
geom_histogram(bins = 5) +
facet_grid(variable~sexo)
names(concordancia_long)
[1] "n_cuestionario" "anos_de_ejercicio_profesional" "sexo"
[4] "nivel_de_estudios" "cantidad_aproximada_de_implantes_instalados" "cantidad_promedio_de_implantes_mensuales"
[7] "variable" "valor" "valor_abs"
m1 <- lm(valor ~ variable +
sexo +
anos_de_ejercicio_profesional +
nivel_de_estudios +
cantidad_aproximada_de_implantes_instalados +
cantidad_promedio_de_implantes_mensuales,
data = concordancia_long)
summary(m1)
Call:
lm(formula = valor ~ variable + sexo + anos_de_ejercicio_profesional +
nivel_de_estudios + cantidad_aproximada_de_implantes_instalados +
cantidad_promedio_de_implantes_mensuales, data = concordancia_long)
Residuals:
Min 1Q Median 3Q Max
-1.8129 -0.3337 -0.1123 0.2001 5.1325
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.3268457 0.5322723 0.614 0.540780
variabledistancia -0.3225000 0.1971614 -1.636 0.105512
variablegrosor -0.1934375 0.1971614 -0.981 0.329258
sexoM 0.1601921 0.2268620 0.706 0.481999
anos_de_ejercicio_profesional 0.0044556 0.0223253 0.200 0.842278
nivel_de_estudiosDiplomado 0.0749264 0.4794972 0.156 0.876190
nivel_de_estudiosEspecialidad 0.3785446 0.5059371 0.748 0.456354
cantidad_aproximada_de_implantes_instalados -0.0003938 0.0001453 -2.709 0.008118 **
cantidad_promedio_de_implantes_mensuales -0.0593747 0.0168639 -3.521 0.000687 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.7886 on 87 degrees of freedom
Multiple R-squared: 0.257, Adjusted R-squared: 0.1886
F-statistic: 3.761 on 8 and 87 DF, p-value: 0.0007963
m2 <- lm(valor_abs ~ variable +
sexo +
anos_de_ejercicio_profesional +
nivel_de_estudios +
cantidad_aproximada_de_implantes_instalados +
cantidad_promedio_de_implantes_mensuales,
data = concordancia_long)
summary(m2)
Call:
lm(formula = valor_abs ~ variable + sexo + anos_de_ejercicio_profesional +
nivel_de_estudios + cantidad_aproximada_de_implantes_instalados +
cantidad_promedio_de_implantes_mensuales, data = concordancia_long)
Residuals:
Min 1Q Median 3Q Max
-0.9211 -0.3119 -0.1322 0.0264 5.1191
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.2301372 0.5260851 0.437 0.6629
variabledistancia 0.0231250 0.1948696 0.119 0.9058
variablegrosor -0.2796875 0.1948696 -1.435 0.1548
sexoM 0.2748686 0.2242250 1.226 0.2236
anos_de_ejercicio_profesional -0.0194449 0.0220658 -0.881 0.3806
nivel_de_estudiosDiplomado -0.0227322 0.4739235 -0.048 0.9619
nivel_de_estudiosEspecialidad 0.0523586 0.5000561 0.105 0.9169
cantidad_aproximada_de_implantes_instalados 0.0003004 0.0001436 2.092 0.0394 *
cantidad_promedio_de_implantes_mensuales 0.0118330 0.0166679 0.710 0.4796
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.7795 on 87 degrees of freedom
Multiple R-squared: 0.1087, Adjusted R-squared: 0.02674
F-statistic: 1.326 on 8 and 87 DF, p-value: 0.2413