# Q.0 - charger les données
library(xlsx)
heart <- read.xlsx("heart.xlsx",sheetName = "heart",stringsAsFactors=TRUE,encoding="UTF-8")
#carac. de la base
str(heart)
## 'data.frame': 270 obs. of 13 variables:
## $ age : num 58 41 58 53 41 65 51 45 55 58 ...
## $ sexe : Factor w/ 2 levels "feminin","masculin": 2 1 2 2 2 1 2 1 2 1 ...
## $ type_douleur: Factor w/ 4 levels "A","B","C","D": 4 2 4 4 3 3 3 2 2 2 ...
## $ pression : num 100 130 150 140 130 155 110 112 130 136 ...
## $ cholester : num 234 204 270 203 214 269 175 160 262 319 ...
## $ sucre : Factor w/ 2 levels "A","B": 1 1 1 2 1 1 1 1 1 2 ...
## $ electro : Factor w/ 3 levels "A","B","C": 1 3 3 3 3 1 1 1 1 3 ...
## $ taux_max : num 156 172 111 155 168 148 123 138 155 152 ...
## $ angine : Factor w/ 2 levels "non","oui": 1 1 2 2 1 1 1 1 1 1 ...
## $ depression : num 1 14 8 31 20 8 6 0 0 0 ...
## $ pic : num 1 1 1 3 2 1 1 2 1 1 ...
## $ vaisseau : Factor w/ 4 levels "A","B","C","D": 2 1 1 1 1 1 1 1 1 3 ...
## $ coeur : Factor w/ 2 levels "absence","presence": 2 1 2 2 1 1 1 1 1 2 ...
# Q.1 - stat. sur angine et coeur
summary(heart[,c("angine","coeur")])
## angine coeur
## non:181 absence :150
## oui: 89 presence:120
# Q.2
# association coeur, angine
# test du khi-2, sans la correction de continuité
# p-value < 0.05, l'hypothèse d'indépendance est démentie par les données
print(chisq.test(x=heart$angine,y=heart$coeur,correct=FALSE))
##
## Pearson's Chi-squared test
##
## data: heart$angine and heart$coeur
## X-squared = 47.47, df = 1, p-value = 5.585e-12
# Q.3
# tableau croisé
tc <- table(heart$coeur,heart$angine)
print(tc)
##
## non oui
## absence 127 23
## presence 54 66
# profil colonne
pc <- prop.table(tc,margin=2)
print(pc)
##
## non oui
## absence 0.7016575 0.2584270
## presence 0.2983425 0.7415730
# vérification des sommes en colonne
print(colSums(pc))
## non oui
## 1 1
# Q.4 - risque relatif
rr <- pc["presence","oui"]/pc["presence","non"]
print(rr)
## [1] 2.485643
# Q.5 - calcul de l'intervalle de confiance
# passage au log.
lrr <- log(rr)
print(lrr)
## [1] 0.9105314
# estimation de la variance
var_rr <- 1.0/(tc["presence","oui"])*pc["absence","oui"]+1.0/(tc["presence","non"])*pc["absence","non"]
print(var_rr)
## [1] 0.01690922
# quantile de la loi normale
u <- qnorm(0.975)
print(u)
## [1] 1.959964
# borne basse - du log_rr vers rr avec la fonction exp()
print(paste("BB =",exp(lrr - u * sqrt(var_rr))))
## [1] "BB = 1.92642618691783"
# borne haute
print(paste("BH =",exp(lrr + u * sqrt(var_rr))))
## [1] "BH = 3.20719314268723"
# les bornes ne contiennent pas la valeur 1
# on peut conclure que risque relatif est significativement différent de 1
# Q.6 - mêmes calculs avec 'epitools'
# epitools - installer au préalable si pas présente
library(epitools)
# calcul
print(epitools::riskratio(y=heart$coeur,x=heart$angine,method="wald"))
## $data
## Outcome
## Predictor absence presence Total
## non 127 54 181
## oui 23 66 89
## Total 150 120 270
##
## $measure
## risk ratio with 95% C.I.
## Predictor estimate lower upper
## non 1.000000 NA NA
## oui 2.485643 1.926426 3.207193
##
## $p.value
## two-sided
## Predictor midp.exact fisher.exact chi.square
## non NA NA NA
## oui 4.691803e-12 4.921297e-12 5.58526e-12
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "Unconditional MLE & normal approximation (Wald) CI"
# Q.7 -- odds-ratio
or <- (pc["presence","oui"]/pc["absence","oui"])/(pc["presence","non"]/pc["absence","non"])
print(or)
## [1] 6.748792
# Q.8 - intervalle de confiance
#log de l'odds-ratio
lor <- log(or)
print(lor)
## [1] 1.909364
# variance de l'odds-ratio
var_or <- sum(sapply(tc,function(x){return(1.0/x)}))
print(var_or)
## [1] 0.08502231
# borne basse
print(paste('BB =',exp(lor - u * sqrt(var_or))))
## [1] "BB = 3.81090156977923"
# borne haute
print(paste('BH =',exp(lor + u * sqrt(var_or))))
## [1] "BH = 11.9515543177419"
# Q.9 - odds-ratio avec epitools
print(epitools::oddsratio(y=heart$coeur,x=heart$angine,method="wald"))
## $data
## Outcome
## Predictor absence presence Total
## non 127 54 181
## oui 23 66 89
## Total 150 120 270
##
## $measure
## odds ratio with 95% C.I.
## Predictor estimate lower upper
## non 1.000000 NA NA
## oui 6.748792 3.810902 11.95155
##
## $p.value
## two-sided
## Predictor midp.exact fisher.exact chi.square
## non NA NA NA
## oui 4.691803e-12 4.921297e-12 5.58526e-12
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "Unconditional MLE & normal approximation (Wald) CI"
# Q.10
# régression logistique
# on remarque que angine est automatiquement recodée en variable binaire 0/1
# angine = non (première modalité par ordre alphabétique) est la modalité exclue
# angine = oui est donc celle qui a été conservée
reg <- summary(glm(coeur ~ angine, data = heart, family = binomial))
print(reg)
##
## Call:
## glm(formula = coeur ~ angine, family = binomial, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.6451 -0.8418 -0.8418 0.7733 1.5553
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.8552 0.1625 -5.264 1.41e-07 ***
## angineoui 1.9094 0.2916 6.548 5.82e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 370.96 on 269 degrees of freedom
## Residual deviance: 322.33 on 268 degrees of freedom
## AIC: 326.33
##
## Number of Fisher Scoring iterations: 4
# Q.11 - atttributs
print(attributes(reg))
## $names
## [1] "call" "terms" "family" "deviance"
## [5] "aic" "contrasts" "df.residual" "null.deviance"
## [9] "df.null" "iter" "deviance.resid" "coefficients"
## [13] "aliased" "dispersion" "df" "cov.unscaled"
## [17] "cov.scaled"
##
## $class
## [1] "summary.glm"
# type du champ "tableau des coefficients"
print(class(reg$coefficients))
## [1] "matrix" "array"
# accès au champ "tableau des coefficients"
print(reg$coefficients)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.855203 0.1624577 -5.264158 1.408334e-07
## angineoui 1.909364 0.2915856 6.548209 5.823136e-11
# Q.12 - dimension "tableau des coefficients"
print(dim(reg$coefficients))
## [1] 2 4
# Q.13 - label des lignes "tableau des coefficients"
print(rownames(reg$coefficients))
## [1] "(Intercept)" "angineoui"
# label des colonnes "tableau des coefficients"
print(colnames(reg$coefficients))
## [1] "Estimate" "Std. Error" "z value" "Pr(>|z|)"
# Q.14 - exp. du coefficient
print(exp(reg$coefficients["angineoui","Estimate"]))
## [1] 6.748792
# Q.15 + 16 - borne basse -- int de confiance à 95% du coefficient de angine_oui
bb_angine <- reg$coefficients["angineoui","Estimate"] - u * reg$coefficients["angineoui","Std. Error"]
print(bb_angine)
## [1] 1.337866
# passage à l'exponentiel
print(exp(bb_angine))
## [1] 3.810903
*** Pour rappel, les résultats fournis pas ‘epitools’
# epitools
print(epitools::oddsratio(y=heart$coeur,x=heart$angine,method="wald"))
## $data
## Outcome
## Predictor absence presence Total
## non 127 54 181
## oui 23 66 89
## Total 150 120 270
##
## $measure
## odds ratio with 95% C.I.
## Predictor estimate lower upper
## non 1.000000 NA NA
## oui 6.748792 3.810902 11.95155
##
## $p.value
## two-sided
## Predictor midp.exact fisher.exact chi.square
## non NA NA NA
## oui 4.691803e-12 4.921297e-12 5.58526e-12
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "Unconditional MLE & normal approximation (Wald) CI"
#borne haute
bh_angine <- reg$coefficients["angineoui","Estimate"] + u * reg$coefficients["angineoui","Std. Error"]
print(bh_angine)
## [1] 2.480861
#passage à l'exponentiel
print(exp(bh_angine))
## [1] 11.95155
# Q.17 - ajouter la variable sexe dans la régression
# observer l'encodage automatique effectué par glm(.)
reg_bis <- summary(glm(coeur ~ angine + sexe, data = heart, family=binomial))
print(reg_bis)
##
## Call:
## glm(formula = coeur ~ angine + sexe, family = binomial, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.7837 -0.9912 -0.5756 0.6751 1.9389
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.7141 0.2911 -5.889 3.88e-09 ***
## angineoui 1.8181 0.3012 6.037 1.57e-09 ***
## sexemasculin 1.2588 0.3176 3.963 7.40e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 370.96 on 269 degrees of freedom
## Residual deviance: 305.27 on 267 degrees of freedom
## AIC: 311.27
##
## Number of Fisher Scoring iterations: 4
# Q.18 - odds-ratio
# odds-ratio = 6.748 dans la régression simple
# ici différent de la régression simple parce angine et sexe ne sont pas indépendants
# l'odds-ratio ici fait l'hypothèse qu'elle est la même chez les hommes et les femmes
print(exp(reg_bis$coefficients["angineoui","Estimate"]))
## [1] 6.16043
# Q.19 - liaison angine et sexe
print(chisq.test(heart$angine,heart$sexe,correct=FALSE))
##
## Pearson's Chi-squared test
##
## data: heart$angine and heart$sexe
## X-squared = 8.7501, df = 1, p-value = 0.003096
# Q.20 - odds-ratio de angine chez les femmes
print(epitools::oddsratio(heart$angine[heart$sexe=="feminin"],heart$coeur[heart$sexe=="feminin"],method="wald"))
## Warning in chisq.test(xx, correct = correction): Chi-squared approximation may
## be incorrect
## $data
## Outcome
## Predictor absence presence Total
## non 59 10 69
## oui 8 10 18
## Total 67 20 87
##
## $measure
## odds ratio with 95% C.I.
## Predictor estimate lower upper
## non 1.000 NA NA
## oui 7.375 2.344282 23.2014
##
## $p.value
## two-sided
## Predictor midp.exact fisher.exact chi.square
## non NA NA NA
## oui 0.0007920958 0.0007092328 0.0002265846
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "Unconditional MLE & normal approximation (Wald) CI"
# odds-ratio de angine chez les hommes
print(epitools::oddsratio(heart$angine[heart$sexe=="masculin"],heart$coeur[heart$sexe=="masculin"],method="wald"))
## $data
## Outcome
## Predictor absence presence Total
## non 68 44 112
## oui 15 56 71
## Total 83 100 183
##
## $measure
## odds ratio with 95% C.I.
## Predictor estimate lower upper
## non 1.000000 NA NA
## oui 5.769697 2.910004 11.43964
##
## $p.value
## two-sided
## Predictor midp.exact fisher.exact chi.square
## non NA NA NA
## oui 1.160078e-07 1.503941e-07 1.589907e-07
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "Unconditional MLE & normal approximation (Wald) CI"
# Q.21 - introduire le terme d'interaction angine x sexe
# il n'est pas significatif à 5%
# être un homme atteint d'une angine n'induit pas un risque accru ou moindre d'être malade
reg_ter <- summary(glm(coeur ~ angine * sexe, data = heart, family=binomial))
print(reg_ter)
##
## Call:
## glm(formula = coeur ~ angine * sexe, family = binomial, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.7633 -0.9990 -0.5596 0.6889 1.9655
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.7750 0.3420 -5.190 2.1e-07 ***
## angineoui 1.9981 0.5848 3.417 0.000633 ***
## sexemasculin 1.3396 0.3929 3.409 0.000651 ***
## angineoui:sexemasculin -0.2455 0.6811 -0.360 0.718542
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 370.96 on 269 degrees of freedom
## Residual deviance: 305.14 on 266 degrees of freedom
## AIC: 313.14
##
## Number of Fisher Scoring iterations: 4
# Q.22 - distribution de fréquences de vaisseau
print(table(heart$vaisseau))
##
## A B C D
## 160 58 33 19
# Q.23 - variable vaisseau : explicative
# vaisseau = A est la modalité de référence
# les coefficients indiquent un risque accru d'être malade lorsqu'on présente
# une modalité de vaisseau autre que A (risque accru par rapport au vaisseau= A)
reg_vaisseau <- summary(glm(coeur ~ vaisseau, data = heart, family=binomial))
print(reg_vaisseau)
##
## Call:
## glm(formula = coeur ~ vaisseau, family = binomial, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9214 -0.7585 -0.7585 0.9196 1.6651
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.0986 0.1826 -6.017 1.77e-09 ***
## vaisseauB 1.7405 0.3311 5.256 1.47e-07 ***
## vaisseauC 2.4108 0.4633 5.203 1.96e-07 ***
## vaisseauD 2.7726 0.6551 4.232 2.31e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 370.96 on 269 degrees of freedom
## Residual deviance: 305.35 on 266 degrees of freedom
## AIC: 313.35
##
## Number of Fisher Scoring iterations: 4
# Q.24 - exponentiel - odds-ratio par rapport à la modalité de référence vaisseau = A
# le coefficient lié à l'intercept n'a pas d'intérêt ici
apply(reg_vaisseau$coefficients,1,function(x){exp(x["Estimate"])})
## (Intercept) vaisseauB vaisseauC vaisseauD
## 0.3333333 5.7000000 11.1428571 16.0000000
# Q.25 - odds-ratio via epitools
print(epitools::oddsratio(y=heart$coeur,x=heart$vaisseau,method="wald"))
## $data
## Outcome
## Predictor absence presence Total
## A 120 40 160
## B 20 38 58
## C 7 26 33
## D 3 16 19
## Total 150 120 270
##
## $measure
## odds ratio with 95% C.I.
## Predictor estimate lower upper
## A 1.00000 NA NA
## B 5.70000 2.978611 10.90777
## C 11.14286 4.493970 27.62886
## D 16.00000 4.430890 57.77621
##
## $p.value
## two-sided
## Predictor midp.exact fisher.exact chi.square
## A NA NA NA
## B 7.176507e-08 7.027937e-08 3.491512e-08
## C 1.045625e-08 9.644499e-09 3.016397e-09
## D 7.259666e-07 6.868193e-07 1.418892e-07
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "Unconditional MLE & normal approximation (Wald) CI"
#Q.26 - tableau croisé
tc_vaisseau <- table(heart$coeur,heart$vaisseau)
print(tc_vaisseau)
##
## A B C D
## absence 120 20 7 3
## presence 40 38 26 16
# Q.27 - odds-ratio
# B / A = comme cas nominal
# C / B et D / C = différents cette fois-ci puisque la modalité de référence est différente
for (j in 2:4){
print(paste(colnames(tc_vaisseau)[j],"=",(tc_vaisseau["presence",j]/tc_vaisseau["absence",j])/(tc_vaisseau["presence",j-1]/tc_vaisseau["absence",j-1])))
}
## [1] "B = 5.7"
## [1] "C = 1.95488721804511"
## [1] "D = 1.43589743589744"
# Q.28 - recodage en variable ordinale
ordinal_vaisseau <- ordered(heart$vaisseau)
# type
print(class(ordinal_vaisseau))
## [1] "ordered" "factor"
#valeurs
print(ordinal_vaisseau)
## [1] B A A A A A A A A C A B A A A C C B A A B B A A A B A B B C A D A A D A C
## [38] A A B A D A B A B C C B A B C A C A B C C A A A B B B C C B A C A A D A A
## [75] C C C A A A D A A A A A B D A A C A B B A A A A A A B A D A A A A B A A A
## [112] A D B C B A A C A A A A A A B A A A B B A A B A D A A D A A A A A A D C A
## [149] A B C A A A A A A B B A B A A A A A A B A A A A C B A B A B A B B D A A A
## [186] A C A A B A A A C B C D A D A B A C A A A A B A A A A A A A D A D B A B A
## [223] A A C C C B C A A B A A A A A A A A A A D A C B A A B A B B B A D B B D A
## [260] C B B B A B A A A A A
## Levels: A < B < C < D
# Q.29 - recodage en indicatrices cumulatives
vais_b <- ifelse(ordinal_vaisseau >= "B",1,0)
vais_c <- ifelse(ordinal_vaisseau >= "C",1,0)
vais_d <- ifelse(ordinal_vaisseau >= "D",1,0)
# variable vaisseau ordinale
# seul le passage B/A induit ue augmentation significative du risque
# pas C/B ni D/C
reg_vaisseau_bis <- summary(glm(coeur ~ vais_b + vais_c + vais_d, data = heart, family=binomial))
print(reg_vaisseau_bis)
##
## Call:
## glm(formula = coeur ~ vais_b + vais_c + vais_d, family = binomial,
## data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9214 -0.7585 -0.7585 0.9196 1.6651
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.0986 0.1826 -6.017 1.77e-09 ***
## vais_b 1.7405 0.3311 5.256 1.47e-07 ***
## vais_c 0.6703 0.5076 1.321 0.187
## vais_d 0.3618 0.7597 0.476 0.634
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 370.96 on 269 degrees of freedom
## Residual deviance: 305.35 on 266 degrees of freedom
## AIC: 313.35
##
## Number of Fisher Scoring iterations: 4
# Q.30 - passage en exponentiel
apply(reg_vaisseau_bis$coefficients,1,function(x){exp(x["Estimate"])})
## (Intercept) vais_b vais_c vais_d
## 0.3333333 5.7000000 1.9548872 1.4358974
# Q.32
# et avec epitools
# /!\ qui ne sait pas tenir compte du caractère ordinal de la variable ordinal_vaisseau
print(epitools::oddsratio(y=heart$coeur,x=ordinal_vaisseau,method="wald"))
## $data
## Outcome
## Predictor absence presence Total
## A 120 40 160
## B 20 38 58
## C 7 26 33
## D 3 16 19
## Total 150 120 270
##
## $measure
## odds ratio with 95% C.I.
## Predictor estimate lower upper
## A 1.00000 NA NA
## B 5.70000 2.978611 10.90777
## C 11.14286 4.493970 27.62886
## D 16.00000 4.430890 57.77621
##
## $p.value
## two-sided
## Predictor midp.exact fisher.exact chi.square
## A NA NA NA
## B 7.176507e-08 7.027937e-08 3.491512e-08
## C 1.045625e-08 9.644499e-09 3.016397e-09
## D 7.259666e-07 6.868193e-07 1.418892e-07
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "Unconditional MLE & normal approximation (Wald) CI"
# Q.33
# boxplot de depression selon coeur
# il y a un décalage des distributions
# on peut différencier les valeurs de coeur avec depression
boxplot(heart$depression ~ heart$coeur)
# Q.34 - regression avec depression
reg_quarter <- summary(glm(coeur ~ depression, data = heart, family=binomial))
print(reg_quarter)
##
## Call:
## glm(formula = coeur ~ depression, family = binomial, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.3302 -0.8645 -0.7406 0.9835 1.6899
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.15357 0.19477 -5.923 3.17e-09 ***
## depression 0.09047 0.01445 6.261 3.84e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 370.96 on 269 degrees of freedom
## Residual deviance: 319.04 on 268 degrees of freedom
## AIC: 323.04
##
## Number of Fisher Scoring iterations: 4
# Q.35 - odds-ratio
# augmentation de risque de maladie induite par une augmentation d'une unité de dépression
print(exp(reg_quarter$coefficients["depression","Estimate"]))
## [1] 1.094694
# Q.36 - regression avec age et depression
# on peut penser que dépression a un impact plus fort avec la z-value (ou la p-value)
reg_quinter <- summary(glm(coeur ~ age + depression, data = heart, family=binomial))
print(reg_quinter)
##
## Call:
## glm(formula = coeur ~ age + depression, family = binomial, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.3235 -0.8842 -0.6243 1.0080 1.9764
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -3.03172 0.85693 -3.538 0.000403 ***
## age 0.03519 0.01541 2.283 0.022428 *
## depression 0.08537 0.01446 5.904 3.54e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 370.96 on 269 degrees of freedom
## Residual deviance: 313.73 on 267 degrees of freedom
## AIC: 319.73
##
## Number of Fisher Scoring iterations: 4
# Q.37 - odds-ratio de depression maintenant
# à âge fixé, l'augmentation de risque associé à une augmentation d'une unité de dépression
# hypothèse induite : l'impact de dépression serait toujours le même quelle que soit l'âge du patient
print(exp(reg_quinter$coefficients["depression","Estimate"]))
## [1] 1.089118
# Q.38 - comparaison des z-values (ou des p-values)
print(reg_quinter$coefficients)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -3.03172264 0.85692574 -3.537906 4.033137e-04
## age 0.03518651 0.01541208 2.283047 2.242762e-02
## depression 0.08536794 0.01445859 5.904305 3.541373e-09
# Q.39 + 40 coef. standardisé - age
# augmentation du LOGIT lorsque l'âge varie d'1 ecart-type
coef_std_age <- reg_quinter$coefficients["age","Estimate"]*sd(heart$age)
print(coef_std_age)
## [1] 0.3205162
# coef. standardisé - depression
coef_std_depression <- reg_quinter$coefficients["depression","Estimate"]*sd(heart$depression)
print(coef_std_depression)
## [1] 0.977642
# Q.41
#impact relatif sur le LOGIT
print(coef_std_depression/coef_std_age)
## [1] 3.050211