Nous allons ici employer les données description :`
VEMS_HID <- read.csv("C:/Users/mallah.s/Desktop/StatsTheses/These_Romane/Av_Ap/avec_HID/VEMS_HID.csv", sep=";", 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()
VEMS_1 <-VEMS_HID %>%
pivot_longer(cols=c(VEMS_ml_0 ,VEMS_ml_1),names_to="periode" ,values_to = "VEMS_ml" )
VEMS_1$periode<- fct_relevel(VEMS_1$periode, c("VEMS_ml_0" ,"VEMS_ml_1"))
head(VEMS_1)
## # A tibble: 6 x 3
## patient_ID periode VEMS_ml
## <fct> <fct> <int>
## 1 3_T VEMS_ml_0 910
## 2 3_T VEMS_ml_1 1300
## 3 4_T VEMS_ml_0 1000
## 4 4_T VEMS_ml_1 890
## 5 5_T VEMS_ml_0 700
## 6 5_T VEMS_ml_1 700
ggplot(VEMS_1 , aes(x=periode, y=VEMS_ml, colour=patient_ID)) +
geom_point()+
geom_line(aes(group=patient_ID))+
theme_classic()+
theme(legend.position = "none")
ggplot(VEMS_1, aes(x=periode, y=VEMS_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
VEMS_HID$d <- VEMS_HID$VEMS_ml_0-VEMS_HID$VEMS_ml_1
head(VEMS_HID)
## patient_ID VEMS_ml_0 VEMS_ml_1 d
## 1 3_T 910 1300 -390
## 2 4_T 1000 890 110
## 3 5_T 700 700 0
## 4 8_T 800 820 -20
## 5 10_T 850 490 360
## 6 11_T 1470 1840 -370
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(VEMS_HID$d)
## [1] 14 5
la normalité est globalement satisfaisante malgres quelques imperfections
shapiro.test(VEMS_HID$d)
##
## Shapiro-Wilk normality test
##
## data: VEMS_HID$d
## W = 0.98397, p-value = 0.86
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(VEMS_HID$VEMS_ml_0 , VEMS_HID$VEMS_ml_1, paired=TRUE)
##
## Paired t-test
##
## data: VEMS_HID$VEMS_ml_0 and VEMS_HID$VEMS_ml_1
## t = -4.1485, df = 36, p-value = 0.000195
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -241.84193 -83.02293
## sample estimates:
## mean of the differences
## -162.4324
L’évolution des moyennes de VEMS (ml) entre les deux périodes est de 162ml /equivalent à 17.23% . La p-value du test est <0.05. Ainsi, les résultats nous indiquent que la VEMS des sujets après traitement est significativement différent de la VEMS avant celui-ci, dans le sens d’une croissance.
si nous calculons le pourcentage de croissance par rapport à la moyenne
summary(VEMS_HID)
## patient_ID VEMS_ml_0 VEMS_ml_1 d
## 1_L : 1 Min. : 480.0 Min. : 490 Min. :-690.0
## 10_L : 1 1st Qu.: 740.0 1st Qu.: 850 1st Qu.:-320.0
## 10_T : 1 Median : 880.0 Median :1020 Median :-130.0
## 11_L : 1 Mean : 944.3 Mean :1107 Mean :-162.4
## 11_T : 1 3rd Qu.:1050.0 3rd Qu.:1350 3rd Qu.: -20.0
## 12_L : 1 Max. :1820.0 Max. :1890 Max. : 360.0
## (Other):31
pour le calcul du pourcentage d’evolution: on utilise la formule ((y2 - y1) / y1)*100 = taux d’ évolution Y1=944.3 Y2=1107 Pourcentage d’évolution de la VEMS est de 17.23%