Nous allons ici employer les données description
:`
VEMS_ml <- read.csv("C:/Users/mallah.s/Desktop/StatsTheses/These_Romane/Av_Ap/VEMS_ml.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()
VEMS1 <-VEMS_ml %>%
pivot_longer(cols=c(VEMS_ml_0 ,VEMS_ml_1),names_to="periode" ,values_to = "VEMS_ml" )
VEMS1$periode<- fct_relevel(VEMS1$periode, c("VEMS_ml_0" ,"VEMS_ml_1"))
head(VEMS1)
## # A tibble: 6 x 3
## patient_ID periode VEMS_ml
## <fct> <fct> <int>
## 1 1_T VEMS_ml_0 700
## 2 1_T VEMS_ml_1 1100
## 3 2_T VEMS_ml_0 600
## 4 2_T VEMS_ml_1 600
## 5 3_T VEMS_ml_0 910
## 6 3_T VEMS_ml_1 1300
ggplot(VEMS1 , aes(x=periode, y=VEMS_ml, colour=patient_ID)) +
geom_point()+
geom_line(aes(group=patient_ID))+
theme_classic()+
theme(legend.position = "none")
ggplot(VEMS1, 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_ml$d <- VEMS_ml$VEMS_ml_0-VEMS_ml$VEMS_ml_1
head(VEMS_ml)
## patient_ID VEMS_ml_0 VEMS_ml_1 d
## 1 1_T 700 1100 -400
## 2 2_T 600 600 0
## 3 3_T 910 1300 -390
## 4 4_T 1000 890 110
## 5 5_T 700 700 0
## 6 6_T 1070 1200 -130
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_ml$d)
## [1] 10 21
la normalité est globalement satisfaisante
shapiro.test(VEMS_ml$d)
##
## Shapiro-Wilk normality test
##
## data: VEMS_ml$d
## W = 0.98837, p-value = 0.9169
Le test de Shapiro-Wilk ne rejette pas l’hypothèse de normalité. 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_ml$VEMS_ml_0 , VEMS_ml$VEMS_ml_1, paired=TRUE)
##
## Paired t-test
##
## data: VEMS_ml$VEMS_ml_0 and VEMS_ml$VEMS_ml_1
## t = -5.1763, df = 46, p-value = 4.854e-06
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -236.9942 -104.2824
## sample estimates:
## mean of the differences
## -170.6383
L’évolution des moyennes de VEMS (ml) entre les deux périodes est de 170ml /equivalent à 18.56% . 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_ml)
## patient_ID VEMS_ml_0 VEMS_ml_1 d
## 1_L : 1 Min. : 480.0 Min. : 490 Min. :-690.0
## 1_T : 1 1st Qu.: 740.0 1st Qu.: 855 1st Qu.:-315.0
## 10_L : 1 Median : 870.0 Median :1040 Median :-140.0
## 10_T : 1 Mean : 918.5 Mean :1089 Mean :-170.6
## 11_L : 1 3rd Qu.:1030.0 3rd Qu.:1270 3rd Qu.: -25.0
## 11_T : 1 Max. :1820.0 Max. :1890 Max. : 360.0
## (Other):41
pour le calcul du pourcentage d’evolution: on utilise la formule ((y2 - y1) / y1)*100 = taux d’ évolution Y1=918.5 Y2=1089 Pourcentage d’évolution de la VEMS est de 18.56%