Nous allons ici employer les données description :`
VR_HID <- read.csv2("C:/Users/mallah.s/Desktop/StatsTheses/These_Romane/Av_Ap/avec_HID/VR_HID.csv", stringsAsFactors=TRUE)
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.0.5
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.2 v dplyr 1.0.7
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.1
## Warning: package 'ggplot2' was built under R version 4.0.5
## Warning: package 'tibble' was built under R version 4.0.5
## Warning: package 'tidyr' was built under R version 4.0.5
## Warning: package 'dplyr' was built under R version 4.0.5
## Warning: package 'forcats' was built under R version 4.0.5
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
VR_1 <-VR_HID %>%
pivot_longer(cols=c(VR_ml_0 ,VR_ml_1),names_to="periode" ,values_to = "VR_ml" )
VR_1$periode<- fct_relevel(VR_1$periode, c("VR_ml_0" ,"VR_ml_1"))
head(VR_1)
## # A tibble: 6 x 3
## patient_ID periode VR_ml
## <fct> <fct> <dbl>
## 1 3_T VR_ml_0 6800
## 2 3_T VR_ml_1 6640
## 3 4_T VR_ml_0 6110
## 4 4_T VR_ml_1 6750
## 5 5_T VR_ml_0 6000
## 6 5_T VR_ml_1 7110
ggplot(VR_1 , aes(x=periode, y=VR_ml, colour=patient_ID)) +
geom_point()+
geom_line(aes(group=patient_ID))+
theme_classic()+
theme(legend.position = "none")
ggplot(VR_1, aes(x=periode, y=VR_ml, colour=patient_ID)) +
geom_point()+
geom_line(aes(group=patient_ID))+
theme_classic()+
theme(legend.position = "none")+
facet_wrap(~patient_ID)
##Calcul de la Difference
VR_HID$d <- VR_HID$VR_ml_0-VR_HID$VR_ml_1
head(VR_HID)
## patient_ID VR_ml_0 VR_ml_1 d
## 1 3_T 6800 6640 160
## 2 4_T 6110 6750 -640
## 3 5_T 6000 7110 -1110
## 4 8_T 5600 5540 60
## 5 10_T 4000 4530 -530
## 6 11_T 5140 4670 470
library(car)
## Warning: package 'car' was built under R version 4.0.5
## Loading required package: carData
##
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
##
## recode
## The following object is masked from 'package:purrr':
##
## some
qqPlot(VR_HID$d)
## [1] 25 3
la normalité est globalement satisfaisante malgres quelques imperfections
shapiro.test(VR_HID$d)
##
## Shapiro-Wilk normality test
##
## data: VR_HID$d
## W = 0.9753, p-value = 0.5697
Le test de Shapiro-Wilk ne rejette pas l’hypothèse de normalité, pvalue>0.05. Au final, nous acceptons cette hypothèse. Nous allons donc pouvoir comparer les moyennes des VEMS avant et après traitement, à l’aide d’un test t apparié:
t.test(VR_HID$VR_ml_0 , VR_HID$VR_ml_1, paired=TRUE)
##
## Paired t-test
##
## data: VR_HID$VR_ml_0 and VR_HID$VR_ml_1
## t = 4.4621, df = 36, p-value = 7.67e-05
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 371.0352 989.3464
## sample estimates:
## mean of the differences
## 680.1908
L’évolution des moyennes de VR (ml) entre les deux périodes est de 680ml /equivalent à une diminution de 13.48% . La p-value du test est <0.05. Ainsi, les résultats nous indiquent que la VR des sujets après traitement est significativement différente de la VR avant celui-ci, dans le sens d’une decroissance.
si nous calculons le pourcentage de decroissance par rapport à la moyenne
summary(VR_HID)
## patient_ID VR_ml_0 VR_ml_1 d
## 1_L : 1 Min. :3190 Min. : 2.94 Min. :-1110.0
## 10_L : 1 1st Qu.:4440 1st Qu.:3750.00 1st Qu.: 160.0
## 10_T : 1 Median :5000 Median :4490.00 Median : 540.0
## 11_L : 1 Mean :5053 Mean :4372.78 Mean : 680.2
## 11_T : 1 3rd Qu.:5410 3rd Qu.:4960.00 3rd Qu.: 1160.0
## 12_L : 1 Max. :7100 Max. :7110.00 Max. : 3187.1
## (Other):31
pour le calcul du pourcentage d’evolution: on utilise la formule ((y2 - y1) / y1)*100 = taux d’ évolution Y1=5053 Y2=4372 Pourcentage d’évolution de la VEMS est de 13.48%