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(RelativeStentExpansion ~
Predilatation + Postdilation +
Raphaecalcification +
SVDmax +
ICD4mm +
CCV
,
data = data1)
summary(mod1)
Call:
lm(formula = RelativeStentExpansion ~ Predilatation + Postdilation +
Raphaecalcification + SVDmax + ICD4mm + CCV, data = data1)
Residuals:
Min 1Q Median 3Q Max
-0.095076 -0.009110 0.006183 0.015923 0.057555
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.184e-01 3.273e-02 25.002 < 2e-16 ***
Predilatation 3.359e-03 6.708e-03 0.501 0.617715
Postdilation 2.917e-02 7.373e-03 3.957 0.000149 ***
Raphaecalcification -1.790e-03 6.630e-03 -0.270 0.787762
SVDmax 1.232e-03 9.888e-04 1.246 0.215808
ICD4mm 1.466e-03 1.618e-03 0.906 0.367438
CCV -6.865e-06 6.108e-06 -1.124 0.263972
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.03005 on 92 degrees of freedom
Multiple R-squared: 0.1939, Adjusted R-squared: 0.1413
F-statistic: 3.688 on 6 and 92 DF, p-value: 0.002502
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(RelativeStentExpansion ~
Predilatation + Postdilation +
Raphaecalcification +
SVDmax +
ICD4mm_calc + #indexado
CCV
,
data = data1)
summary(mod2)
Call:
lm(formula = RelativeStentExpansion ~ Predilatation + Postdilation +
Raphaecalcification + SVDmax + ICD4mm_calc + CCV, data = data1)
Residuals:
Min 1Q Median 3Q Max
-0.095424 -0.011741 0.005365 0.014660 0.056493
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.260e-01 5.926e-02 13.940 < 2e-16 ***
Predilatation 3.456e-03 6.804e-03 0.508 0.612712
Postdilation 2.822e-02 7.334e-03 3.848 0.000219 ***
Raphaecalcification -2.323e-03 6.653e-03 -0.349 0.727725
SVDmax 1.809e-03 7.495e-04 2.414 0.017773 *
ICD4mm_calc 9.590e-03 5.092e-02 0.188 0.851034
CCV -5.186e-06 5.833e-06 -0.889 0.376285
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.03018 on 92 degrees of freedom
Multiple R-squared: 0.187, Adjusted R-squared: 0.134
F-statistic: 3.527 on 6 and 92 DF, p-value: 0.003468
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)
NA
Modelo 3
mod3=lm(RelativeStentExpansion ~
Predilatation + Postdilation +
Raphaecalcification +
SVDmax +
ICD4mm +
CCV_calc #indexado
,
data = data1)
summary(mod3)
Call:
lm(formula = RelativeStentExpansion ~ Predilatation + Postdilation +
Raphaecalcification + SVDmax + ICD4mm + CCV_calc, data = data1)
Residuals:
Min 1Q Median 3Q Max
-0.095884 -0.009699 0.005565 0.015716 0.058284
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.8289477 0.0300761 27.562 < 2e-16 ***
Predilatation 0.0033817 0.0067118 0.504 0.615570
Postdilation 0.0290700 0.0073675 3.946 0.000155 ***
Raphaecalcification -0.0017349 0.0066443 -0.261 0.794586
SVDmax 0.0012032 0.0009864 1.220 0.225680
ICD4mm 0.0011291 0.0015506 0.728 0.468379
CCV_calc -0.0037446 0.0033261 -1.126 0.263157
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.03005 on 92 degrees of freedom
Multiple R-squared: 0.1939, Adjusted R-squared: 0.1413
F-statistic: 3.689 on 6 and 92 DF, p-value: 0.002498
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(RelativeStentExpansion ~
Predilatation + Postdilation +
Raphaecalcification +
SVDmax +
ICD4mm_calc + #indexado
CCV_calc #indexado
,
data = data1)
summary(mod4)
Call:
lm(formula = RelativeStentExpansion ~ Predilatation + Postdilation +
Raphaecalcification + SVDmax + ICD4mm_calc + CCV_calc, data = data1)
Residuals:
Min 1Q Median 3Q Max
-0.096496 -0.010932 0.007331 0.015341 0.056704
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.825267 0.058974 13.994 < 2e-16 ***
Predilatation 0.003845 0.006817 0.564 0.574031
Postdilation 0.028434 0.007325 3.882 0.000195 ***
Raphaecalcification -0.001751 0.006707 -0.261 0.794677
SVDmax 0.001695 0.000695 2.439 0.016642 *
ICD4mm_calc 0.015031 0.051262 0.293 0.770015
CCV_calc -0.003557 0.003336 -1.066 0.289104
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.03012 on 92 degrees of freedom
Multiple R-squared: 0.19, Adjusted R-squared: 0.1372
F-statistic: 3.597 on 6 and 92 DF, p-value: 0.003006
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(RelativeStentExpansion ~
Predilatation + Postdilation +
Raphaecalcification +
MaxSinAnnDcalc + #indexado
ICD4mm_calc + #indexado
CCV_calc #indexado
,
data = data1)
summary(mod5)
Call:
lm(formula = RelativeStentExpansion ~ Predilatation + Postdilation +
Raphaecalcification + MaxSinAnnDcalc + ICD4mm_calc + CCV_calc,
data = data1)
Residuals:
Min 1Q Median 3Q Max
-0.09955 -0.01282 0.00505 0.01926 0.06358
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.857513 0.060085 14.272 < 2e-16 ***
Predilatation 0.006333 0.006952 0.911 0.364647
Postdilation 0.027388 0.007554 3.626 0.000472 ***
Raphaecalcification -0.001544 0.006900 -0.224 0.823422
MaxSinAnnDcalc 0.019804 0.026421 0.750 0.455449
ICD4mm_calc 0.014205 0.055750 0.255 0.799440
CCV_calc -0.002005 0.003368 -0.595 0.553017
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.03099 on 92 degrees of freedom
Multiple R-squared: 0.1429, Adjusted R-squared: 0.08698
F-statistic: 2.556 on 6 and 92 DF, p-value: 0.02465
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(RelativeStentExpansion ~
Predilatation + Postdilation +
Raphaecalcification +
MaxSinAnnDcalc + #indexado
ICD4mm_calc + #indexado
CCV
,
data = data1)
summary(mod6)
Call:
lm(formula = RelativeStentExpansion ~ Predilatation + Postdilation +
Raphaecalcification + MaxSinAnnDcalc + ICD4mm_calc + CCV,
data = data1)
Residuals:
Min 1Q Median 3Q Max
-0.096493 -0.013085 0.004841 0.018938 0.065123
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.623e-01 5.983e-02 14.413 < 2e-16 ***
Predilatation 4.913e-03 6.979e-03 0.704 0.483223
Postdilation 2.729e-02 7.566e-03 3.607 0.000503 ***
Raphaecalcification -3.103e-03 6.836e-03 -0.454 0.650940
MaxSinAnnDcalc 1.755e-02 2.633e-02 0.666 0.506778
ICD4mm_calc 1.008e-02 5.563e-02 0.181 0.856627
CCV 5.428e-07 5.441e-06 0.100 0.920761
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.03105 on 92 degrees of freedom
Multiple R-squared: 0.1397, Adjusted R-squared: 0.08356
F-statistic: 2.489 on 6 and 92 DF, p-value: 0.02816
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 = RSEcalc ~
Predilatation + Postdilation +
Raphaecalcification +
MaxSinAnnDcalc + #indexado
ICD4mm_calc + #indexado
CCV_calc #indexado
,
family = "binomial", data = data1)
summary(mod7)
Call:
glm(formula = RSEcalc ~ Predilatation + Postdilation + Raphaecalcification +
MaxSinAnnDcalc + ICD4mm_calc + CCV_calc, family = "binomial",
data = data1)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.875 -1.197 0.553 1.039 1.403
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -5.1949 4.3806 -1.186 0.2357
Predilatation 0.4193 0.4980 0.842 0.3998
Postdilation 1.7149 0.6793 2.524 0.0116 *
Raphaecalcification 0.4041 0.4920 0.821 0.4115
MaxSinAnnDcalc 1.4201 1.9183 0.740 0.4591
ICD4mm_calc 3.4552 3.9749 0.869 0.3847
CCV_calc -0.4157 0.2457 -1.692 0.0907 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 130.86 on 98 degrees of freedom
Residual deviance: 119.03 on 92 degrees of freedom
AIC: 133.03
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