library(readxl)
library(ggplot2)
library(CGPfunctions)
library(plotly)
library(lmtest)
#Definir directorio
setwd("G:/TRABAJO/CONSULTORIAS/TRABAJOS VARIOS/JORGE CHAVARRIA/analisis4")
data1 = read_excel("Bicuspid4.xlsx")
head(data1,5)
Modelo 1
mod1=lm(Ellipticity ~
Predilatation + Postdilation +
Raphaecalcification +
SVDmax +
ICD4mm +
CCV
,
data = data1)
summary(mod1)
Call:
lm(formula = Ellipticity ~ Predilatation + Postdilation + Raphaecalcification +
SVDmax + ICD4mm + CCV, data = data1)
Residuals:
Min 1Q Median 3Q Max
-0.07665 -0.02952 -0.00092 0.02322 0.11700
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.119e+00 4.281e-02 26.136 <2e-16 ***
Predilatation 7.993e-04 8.773e-03 0.091 0.9276
Postdilation -9.231e-03 9.642e-03 -0.957 0.3409
Raphaecalcification 1.648e-02 8.671e-03 1.901 0.0605 .
SVDmax -2.460e-03 1.293e-03 -1.902 0.0602 .
ICD4mm 1.915e-03 2.116e-03 0.905 0.3678
CCV 6.266e-06 7.988e-06 0.784 0.4349
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.0393 on 92 degrees of freedom
Multiple R-squared: 0.09752, Adjusted R-squared: 0.03866
F-statistic: 1.657 on 6 and 92 DF, p-value: 0.1406
Calculos Intervalo de confianza Regresion Lineal Modelo 1
# Obtener el resumen del modelo
summary_mod1 <- summary(mod1)
# Extraer los coeficientes
coefficients <- coef(summary_mod1)[, 1]
# Extraer los intervalos de confianza
conf_intervals <- confint(mod1)
# Extraer los p-values
p_values <- summary_mod1$coefficients[, 4]
# Crear el data frame consolidado
consolidado1 <- data.frame(Coefficient = coefficients,
Lower_CI = conf_intervals[, 1],
Upper_CI = conf_intervals[, 2],
p_value = p_values)
# Mostrar el data frame consolidado Modelo 1
print(consolidado1)
NA
Modelo 2
mod2=lm(Ellipticity ~
Predilatation + Postdilation +
Raphaecalcification +
SVDmax +
ICD4mm_calc + #indexado
CCV
,
data = data1)
summary(mod2)
Call:
lm(formula = Ellipticity ~ Predilatation + Postdilation + Raphaecalcification +
SVDmax + ICD4mm_calc + CCV, data = data1)
Residuals:
Min 1Q Median 3Q Max
-0.092449 -0.024742 -0.002218 0.021768 0.113101
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.457e-01 7.407e-02 12.769 < 2e-16 ***
Predilatation 4.246e-03 8.505e-03 0.499 0.61884
Postdilation -8.412e-03 9.167e-03 -0.918 0.36124
Raphaecalcification 1.813e-02 8.316e-03 2.180 0.03182 *
SVDmax -1.992e-03 9.369e-04 -2.126 0.03617 *
ICD4mm_calc 1.883e-01 6.365e-02 2.959 0.00393 **
CCV 7.524e-06 7.290e-06 1.032 0.30478
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.03772 on 92 degrees of freedom
Multiple R-squared: 0.1686, Adjusted R-squared: 0.1144
F-statistic: 3.109 on 6 and 92 DF, p-value: 0.008085
Calculos Intervalo de confianza Regresion Lineal Modelo 2
# Obtener el resumen del modelo
summary_mod2 <- summary(mod2)
# Extraer los coeficientes
coefficients <- coef(summary_mod2)[, 1]
# Extraer los intervalos de confianza
conf_intervals <- confint(mod2)
# Extraer los p-values
p_values <- summary_mod2$coefficients[, 4]
# Crear el data frame consolidado
consolidado2 <- data.frame(Coefficient = coefficients,
Lower_CI = conf_intervals[, 1],
Upper_CI = conf_intervals[, 2],
p_value = p_values)
# Mostrar el data frame consolidado Modelo 1
print(consolidado2)
Modelo 3
mod3=lm(Ellipticity ~
Predilatation + Postdilation +
Raphaecalcification +
SVDmax +
ICD4mm +
CCV_calc #indexado
,
data = data1)
summary(mod3)
Call:
lm(formula = Ellipticity ~ Predilatation + Postdilation + Raphaecalcification +
SVDmax + ICD4mm + CCV_calc, data = data1)
Residuals:
Min 1Q Median 3Q Max
-0.069053 -0.026743 -0.001909 0.022573 0.117635
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.114608 0.038779 28.742 <2e-16 ***
Predilatation -0.001202 0.008654 -0.139 0.8898
Postdilation -0.009596 0.009499 -1.010 0.3150
Raphaecalcification 0.013713 0.008567 1.601 0.1129
SVDmax -0.002534 0.001272 -1.992 0.0493 *
ICD4mm 0.001951 0.001999 0.976 0.3316
CCV_calc 0.007780 0.004289 1.814 0.0729 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.03875 on 92 degrees of freedom
Multiple R-squared: 0.1229, Adjusted R-squared: 0.06566
F-statistic: 2.148 on 6 and 92 DF, p-value: 0.05524
Calculos Intervalo de confianza Regresion Lineal Modelo 3
# Obtener el resumen del modelo
summary_mod3 <- summary(mod3)
# Extraer los coeficientes
coefficients <- coef(summary_mod3)[, 1]
# Extraer los intervalos de confianza
conf_intervals <- confint(mod3)
# Extraer los p-values
p_values <- summary_mod3$coefficients[, 4]
# Crear el data frame consolidado
consolidado3 <- data.frame(Coefficient = coefficients,
Lower_CI = conf_intervals[, 1],
Upper_CI = conf_intervals[, 2],
p_value = p_values)
# Mostrar el data frame consolidado Modelo 1
print(consolidado3)
NA
Modelo 4
mod4=lm(Ellipticity ~
Predilatation + Postdilation +
Raphaecalcification +
SVDmax +
ICD4mm_calc + #indexado
CCV_calc #indexado
,
data = data1)
summary(mod4)
Call:
lm(formula = Ellipticity ~ Predilatation + Postdilation + Raphaecalcification +
SVDmax + ICD4mm_calc + CCV_calc, data = data1)
Residuals:
Min 1Q Median 3Q Max
-0.086384 -0.024556 -0.002889 0.020226 0.113059
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.951193 0.073230 12.989 < 2e-16 ***
Predilatation 0.002877 0.008464 0.340 0.73471
Postdilation -0.008853 0.009096 -0.973 0.33297
Raphaecalcification 0.016276 0.008329 1.954 0.05372 .
SVDmax -0.001903 0.000863 -2.205 0.02995 *
ICD4mm_calc 0.177071 0.063655 2.782 0.00656 **
CCV_calc 0.006746 0.004143 1.628 0.10686
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.03741 on 92 degrees of freedom
Multiple R-squared: 0.1825, Adjusted R-squared: 0.1292
F-statistic: 3.424 on 6 and 92 DF, p-value: 0.004273
Calculos Intervalo de confianza Regresion Lineal Modelo 4
# Obtener el resumen del modelo
summary_mod4 <- summary(mod4)
# Extraer los coeficientes
coefficients <- coef(summary_mod4)[, 1]
# Extraer los intervalos de confianza
conf_intervals <- confint(mod4)
# Extraer los p-values
p_values <- summary_mod4$coefficients[, 4]
# Crear el data frame consolidado
consolidado4 <- data.frame(Coefficient = coefficients,
Lower_CI = conf_intervals[, 1],
Upper_CI = conf_intervals[, 2],
p_value = p_values)
# Mostrar el data frame consolidado Modelo 1
print(consolidado4)
Modelo 5
mod5=lm(Ellipticity ~
Predilatation + Postdilation +
Raphaecalcification +
MaxSinAnnDcalc + #indexado
ICD4mm_calc + #indexado
CCV_calc #indexado
,
data = data1)
summary(mod5)
Call:
lm(formula = Ellipticity ~ Predilatation + Postdilation + Raphaecalcification +
MaxSinAnnDcalc + ICD4mm_calc + CCV_calc, data = data1)
Residuals:
Min 1Q Median 3Q Max
-0.087251 -0.023916 -0.003034 0.023495 0.114802
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.255e-01 7.386e-02 12.530 < 2e-16 ***
Predilatation -8.898e-05 8.545e-03 -0.010 0.99171
Postdilation -7.319e-03 9.285e-03 -0.788 0.43261
Raphaecalcification 1.599e-02 8.482e-03 1.885 0.06263 .
MaxSinAnnDcalc -3.850e-02 3.248e-02 -1.185 0.23890
ICD4mm_calc 1.897e-01 6.853e-02 2.768 0.00683 **
CCV_calc 5.273e-03 4.140e-03 1.274 0.20596
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.03809 on 92 degrees of freedom
Multiple R-squared: 0.1523, Adjusted R-squared: 0.097
F-statistic: 2.755 on 6 and 92 DF, p-value: 0.01656
Calculos Intervalo de confianza Regresion Lineal Modelo 5
# Obtener el resumen del modelo
summary_mod5 <- summary(mod5)
# Extraer los coeficientes
coefficients <- coef(summary_mod5)[, 1]
# Extraer los intervalos de confianza
conf_intervals <- confint(mod5)
# Extraer los p-values
p_values <- summary_mod5$coefficients[, 4]
# Crear el data frame consolidado
consolidado5 <- data.frame(Coefficient = coefficients,
Lower_CI = conf_intervals[, 1],
Upper_CI = conf_intervals[, 2],
p_value = p_values)
# Mostrar el data frame consolidado Modelo 1
print(consolidado5)
Modelo 6
mod6=lm(Ellipticity ~
Predilatation + Postdilation +
Raphaecalcification +
MaxSinAnnDcalc + #indexado
ICD4mm_calc + #indexado
CCV
,
data = data1)
summary(mod6)
Call:
lm(formula = Ellipticity ~ Predilatation + Postdilation + Raphaecalcification +
MaxSinAnnDcalc + ICD4mm_calc + CCV, data = data1)
Residuals:
Min 1Q Median 3Q Max
-0.096452 -0.027094 -0.003153 0.024810 0.113320
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.147e-01 7.404e-02 12.354 <2e-16 ***
Predilatation 2.540e-03 8.636e-03 0.294 0.7694
Postdilation -7.052e-03 9.362e-03 -0.753 0.4532
Raphaecalcification 1.901e-02 8.459e-03 2.247 0.0270 *
MaxSinAnnDcalc -3.371e-02 3.259e-02 -1.034 0.3036
ICD4mm_calc 1.985e-01 6.884e-02 2.884 0.0049 **
CCV 1.458e-06 6.733e-06 0.216 0.8291
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.03842 on 92 degrees of freedom
Multiple R-squared: 0.1378, Adjusted R-squared: 0.08154
F-statistic: 2.45 on 6 and 92 DF, p-value: 0.03044
Calculos Intervalo de confianza Regresion Lineal Modelo 6
# Obtener el resumen del modelo
summary_mod6 <- summary(mod6)
# Extraer los coeficientes
coefficients <- coef(summary_mod6)[, 1]
# Extraer los intervalos de confianza
conf_intervals <- confint(mod6)
# Extraer los p-values
p_values <- summary_mod6$coefficients[, 4]
# Crear el data frame consolidado
consolidado6 <- data.frame(Coefficient = coefficients,
Lower_CI = conf_intervals[, 1],
Upper_CI = conf_intervals[, 2],
p_value = p_values)
# Mostrar el data frame consolidado Modelo 1
print(consolidado6)
Regresion Logistica
mod7 <- glm(formula = Ellipticitycalc ~
Predilatation + Postdilation +
Raphaecalcification +
MaxSinAnnDcalc + #indexado
ICD4mm_calc + #indexado
CCV_calc #indexado
,
family = "binomial", data = data1)
summary(mod7)
Call:
glm(formula = Ellipticitycalc ~ Predilatation + Postdilation +
Raphaecalcification + MaxSinAnnDcalc + ICD4mm_calc + CCV_calc,
family = "binomial", data = data1)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.8991 -1.0168 -0.5704 1.0444 1.9476
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -8.8395 4.5793 -1.930 0.05357 .
Predilatation -0.2636 0.4963 -0.531 0.59539
Postdilation -0.3861 0.5369 -0.719 0.47206
Raphaecalcification 0.6055 0.4877 1.242 0.21440
MaxSinAnnDcalc -3.9400 1.8941 -2.080 0.03751 *
ICD4mm_calc 12.5321 4.4240 2.833 0.00462 **
CCV_calc 0.2779 0.2403 1.156 0.24763
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 136.75 on 98 degrees of freedom
Residual deviance: 121.22 on 92 degrees of freedom
AIC: 135.22
Number of Fisher Scoring iterations: 4
Calculos de Odd Ratio modelo 7
#Resumen modelo logistico
summary_mod7 <- summary(mod7)
# Extraer los odds ratios
odds_ratios <- exp(summary_mod7$coefficients[, 1])
# Extraer los intervalos de confianza
conf_intervals <- exp(confint(mod7))
Waiting for profiling to be done...
# Extraer los p-values
p_values <- summary_mod7$coefficients[, 4]
# Crear el data frame consolidado
consolidado7 <- data.frame(Odds_Ratio = odds_ratios,
Lower_CI = conf_intervals[, 1],
Upper_CI = conf_intervals[, 2],
p_value = p_values)
# Mostrar el data frame consolidado
print(consolidado7)
NA