##chargement des packages----
library(questionr)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.1 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.2 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(tableone)
library(labelled)
library(gtsummary)
library(GGally)
## Registered S3 method overwritten by 'GGally':
## method from
## +.gg ggplot2
library(readxl)
library(effects)
## Le chargement a nécessité le package : carData
## lattice theme set by effectsTheme()
## See ?effectsTheme for details.
library(survival)
library(survminer)
## Le chargement a nécessité le package : ggpubr
##
## Attachement du package : 'survminer'
##
## L'objet suivant est masqué depuis 'package:survival':
##
## myeloma
library(ggplot2)
library(dplyr)
library(knitr)
library(cowplot)
##
## Attachement du package : 'cowplot'
##
## L'objet suivant est masqué depuis 'package:ggpubr':
##
## get_legend
##
## L'objet suivant est masqué depuis 'package:lubridate':
##
## stamp
library(hrbrthemes)
##chargement des données
stats_apoteca <- read_excel("C:/datar/stats_apoteca.xlsx")
## New names:
## • `Concentration attendue (mg/mL)` -> `Concentration attendue (mg/mL)...29`
## • `Concentration attendue (mg/mL)` -> `Concentration attendue (mg/mL)...43`
##recodage des variables et bases de données le cas échéant----
stats_apoteca$ok_apoteca<-ifelse(
stats_apoteca$ecart_apoteca<5 &
stats_apoteca$ecart_apoteca>-5, 1, 0)
stats_apoteca$ok_gravi<-ifelse(
stats_apoteca$ecart_gravi_ext<5 &
stats_apoteca$ecart_gravi_ext>-5, 1, 0)
table(stats_apoteca$ok_apoteca)
##
## 1
## 735
table(stats_apoteca$ok_gravi)
##
## 0 1
## 5 730
##tests préliminaire de concordance entre pesée interne APOTECA et contrôle grvimetrique externe
##sous groupe de données
test_balance<-filter(stats_apoteca, c(eligible_test_balance== "oui"))
##corrélation entre contrôle apoteca et contrôle externe
mod<-(lm(ecart_gravi_ext~ecart_apoteca, data=test_balance))
summary(mod)
##
## Call:
## lm(formula = ecart_gravi_ext ~ ecart_apoteca, data = test_balance)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.8110 -0.2714 -0.0269 0.2216 4.6184
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.03315 0.07129 0.465 0.643
## ecart_apoteca 0.83785 0.07747 10.815 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.9549 on 178 degrees of freedom
## Multiple R-squared: 0.3965, Adjusted R-squared: 0.3932
## F-statistic: 117 on 1 and 178 DF, p-value: < 2.2e-16
mod%>%tbl_regression(intercept = TRUE)
| Characteristic |
Beta |
95% CI |
p-value |
| (Intercept) |
0.03 |
-0.11, 0.17 |
0.6 |
| ecart_apoteca |
0.84 |
0.68, 0.99 |
<0.001 |
cor(test_balance$ecart_gravi_ext, test_balance$ecart_apoteca, use="complete.obs")
## [1] 0.6297209
##conclusion = bonne corrélation entre le résultat de la pesée APOTECA
##et la pesée externe
##tableau descriptif des ecarts apoteca et gravimetrie externe selon poches de solvant ----
tbl_summary(
test_balance, include = c("ecart_apoteca", "ecart_gravi_ext"),
by="volume_solvant",
digits=all_categorical()~ c(0,1)
)%>%
add_p()
| Characteristic |
55, N = 54 |
107, N = 54 |
268, N = 45 |
520, N = 27 |
p-value |
| ecart_apoteca |
0.36 (-0.15, 0.53) |
0.16 (-0.41, 0.62) |
0.23 (-0.75, 0.62) |
0.23 (-0.78, 0.62) |
0.8 |
| ecart_gravi_ext |
0.44 (-0.45, 0.71) |
0.22 (-0.58, 0.71) |
0.16 (-1.23, 0.71) |
0.33 (-0.79, 0.71) |
>0.9 |
##concusion : pas d'influence du volume des poches sur le résultat de la pesée
## que ce soit pour apoteca ou la balance externe
##Tests de la capacité du robot à effectuer des dilutions en poche sans retrait préalable
## comparaison pesée apoteca vs contrôle gravimetrique externe
##sous groupe de données
ajout<-filter(stats_apoteca, c(eligible_ajout=="oui"))
##correlation entre ecart apoteca et gravi externe
mod<-(lm(ecart_gravi_ext~ecart_apoteca, data=ajout))
summary(mod)
##
## Call:
## lm(formula = ecart_gravi_ext ~ ecart_apoteca, data = ajout)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.5171 -0.2176 0.0327 0.1818 4.6719
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.05601 0.04497 -1.246 0.214
## ecart_apoteca 0.93782 0.03053 30.715 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.8833 on 385 degrees of freedom
## (1 observation effacée parce que manquante)
## Multiple R-squared: 0.7102, Adjusted R-squared: 0.7094
## F-statistic: 943.4 on 1 and 385 DF, p-value: < 2.2e-16
mod%>%tbl_regression(intercept = TRUE)
| Characteristic |
Beta |
95% CI |
p-value |
| (Intercept) |
-0.06 |
-0.14, 0.03 |
0.2 |
| ecart_apoteca |
0.94 |
0.88, 1.0 |
<0.001 |
cor(ajout$ecart_gravi_ext, ajout$ecart_apoteca, use="complete.obs")
## [1] 0.8427209
##conclusion très bonne corrélation
##influence des covariables sur cette correlation
##test interaction volume dci
mod<-(lm(ecart_gravi_ext~ecart_apoteca*volume_dci, data=ajout))
summary(mod)
##
## Call:
## lm(formula = ecart_gravi_ext ~ ecart_apoteca * volume_dci, data = ajout)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.4702 -0.2398 0.0075 0.2641 4.6185
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.310281 0.114775 -2.703 0.00717 **
## ecart_apoteca 0.942813 0.056834 16.589 < 2e-16 ***
## volume_dci 0.021925 0.008433 2.600 0.00969 **
## ecart_apoteca:volume_dci -0.004300 0.004495 -0.957 0.33934
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.8766 on 383 degrees of freedom
## (1 observation effacée parce que manquante)
## Multiple R-squared: 0.7161, Adjusted R-squared: 0.7138
## F-statistic: 322 on 3 and 383 DF, p-value: < 2.2e-16
##test interaction volume_solvant
mod<-(lm(ecart_gravi_ext~ecart_apoteca*volume_solvant, data=ajout))
summary(mod)
##
## Call:
## lm(formula = ecart_gravi_ext ~ ecart_apoteca * volume_solvant,
## data = ajout)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.4801 -0.2457 0.0531 0.2077 4.6420
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.1176497 0.0670347 -1.755 0.0800 .
## ecart_apoteca 1.0099321 0.0483508 20.888 <2e-16 ***
## volume_solvant 0.0005208 0.0003669 1.420 0.1565
## ecart_apoteca:volume_solvant -0.0007717 0.0003810 -2.026 0.0435 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.8773 on 383 degrees of freedom
## (1 observation effacée parce que manquante)
## Multiple R-squared: 0.7156, Adjusted R-squared: 0.7134
## F-statistic: 321.3 on 3 and 383 DF, p-value: < 2.2e-16
##conclusion influence du volume des poches (plus il est important moins bonne est la corrélation (facteur poid total de la poche))
##test interaction viscosité
mod<-(lm(ecart_gravi_ext~ecart_apoteca*dci, data=ajout))
summary(mod)
##
## Call:
## lm(formula = ecart_gravi_ext ~ ecart_apoteca * dci, data = ajout)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.3869 -0.2146 0.0260 0.2307 4.6757
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.04255 0.05215 -0.816 0.415
## ecart_apoteca 0.88938 0.03719 23.916 <2e-16 ***
## dcipaclitaxel -0.06818 0.10183 -0.670 0.504
## ecart_apoteca:dcipaclitaxel 0.14855 0.06459 2.300 0.022 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.879 on 383 degrees of freedom
## (1 observation effacée parce que manquante)
## Multiple R-squared: 0.7145, Adjusted R-squared: 0.7123
## F-statistic: 319.5 on 3 and 383 DF, p-value: < 2.2e-16
##conclusion influence de la viscosité (meilleure correlation pour paclitaxel)
##regroupement des données pour représentation graphique
ajout_apoteca<-subset(ajout, select =c(volume_solvant,
dci, volume_dci, ecart_apoteca, type_ecart_apoteca))
ajout_gravi<-subset(ajout, select =c(volume_solvant,
dci, volume_dci, ecart_gravi_ext, type_ecart_gravi))
ajout_apoteca$ecart<-ajout_apoteca$ecart_apoteca
ajout_gravi$ecart<-ajout_gravi$ecart_gravi_ext
ajout_apoteca$type_ecart<-ajout_apoteca$type_ecart_apoteca
ajout_gravi$type_ecart<-ajout_gravi$type_ecart_gravi
##regroupement en un seul tableau
complet<-bind_rows(ajout_apoteca, ajout_gravi)
complet
## # A tibble: 776 × 9
## volume_solvant dci volume_dci ecart_apoteca type_ecart_apoteca ecart
## <dbl> <chr> <dbl> <dbl> <chr> <dbl>
## 1 520 fluorouraci… 15 0.616 ecart_apoteca 0.616
## 2 520 fluorouraci… 15 0.616 ecart_apoteca 0.616
## 3 520 fluorouraci… 15 0.745 ecart_apoteca 0.745
## 4 268 fluorouraci… 15 0.616 ecart_apoteca 0.616
## 5 268 fluorouraci… 15 0.680 ecart_apoteca 0.680
## 6 268 fluorouraci… 15 0.809 ecart_apoteca 0.809
## 7 107 fluorouraci… 15 0.875 ecart_apoteca 0.875
## 8 107 fluorouraci… 15 0.745 ecart_apoteca 0.745
## 9 107 fluorouraci… 15 0.616 ecart_apoteca 0.616
## 10 55 fluorouraci… 15 0.551 ecart_apoteca 0.551
## # ℹ 766 more rows
## # ℹ 3 more variables: type_ecart <chr>, ecart_gravi_ext <dbl>,
## # type_ecart_gravi <chr>
complet$volume_solvant.cat<-factor(complet$volume_solvant)
complet$volume_dci.cat<-factor(complet$volume_dci)
complet$dci<-factor(complet$volume_solvant)
##boxplots selon variables
g1<-ggplot(complet, aes(x=volume_solvant.cat, y=ecart, fill=type_ecart)) +
geom_boxplot()+
geom_hline(yintercept = 5)+
geom_hline(yintercept = -5)
g2<-ggplot(complet, aes(x=volume_dci.cat, y=ecart, fill=type_ecart)) +
geom_boxplot()+ geom_hline(yintercept = 5)+
geom_hline(yintercept = -5)
g3<-ggplot(complet, aes(x=dci, y=ecart, fill=type_ecart)) +
geom_boxplot()+
geom_hline(yintercept = 5)+
geom_hline(yintercept = -5)
plot_grid(g1, g2, g3)
## Warning: Removed 2 rows containing non-finite values (`stat_boxplot()`).
## Removed 2 rows containing non-finite values (`stat_boxplot()`).
## Removed 2 rows containing non-finite values (`stat_boxplot()`).

##même si influence du volume des poches et de la viscosité, on reste toujours sur des valeurs chevauchantes et dans les marges d'acceptation
###
##tests de dilution avec retrait préalable de volume des poches
retrait<-filter(stats_apoteca, c(eligible_retrait=="oui"))
retrait$volume_retrait.cat<-factor(retrait$volume_retrait)
##performance du retrait de volume des poches
##renommer des variables pour présentation dans les tableaux de résultats
library(labelled)
var_label(retrait$ecart_apoteca) <- "Ecart de dose selon Apoteca"
var_label(retrait$ecart_gravi_ext) <- "Ecart de poids final selon balance externe"
var_label(retrait$ecart_retrait_apoteca) <- "Ecart sur retrait préalable de solvant"
var_label(retrait$ecart_hplc) <- "Ecart entre concentration finale et concentration théorique"
var_label(retrait$ecart_hplc_cg) <- "Ecart entre concentration finale et concentration théorique (recalcul par CG)"
##resumé des ecarts observés
tbl_summary(
retrait, include = c("ecart_apoteca","ecart_gravi_ext",
"ecart_retrait_apoteca", "ecart_hplc", "ecart_hplc_cg" ),
statistic = all_continuous() ~ "{median}[{min} - {max}]",
digits=all_categorical()~ c(0,1)
)
| Characteristic |
N = 210 |
| Ecart de dose selon Apoteca |
0.31[-4.87 - 3.00] |
| Ecart de poids final selon balance externe |
-0.67[-11.10 - 0.77] |
| Ecart sur retrait préalable de solvant |
1[-10 - 52] |
| Ecart entre concentration finale et concentration théorique |
-1.04[-8.11 - 6.76] |
| Ecart entre concentration finale et concentration théorique (recalcul par CG) |
-1.14[-6.85 - 5.38] |
##description des erreurs de retrait de volume
retrait$volume_retrait.cat<-factor(retrait$volume_retrait)
ggplot(retrait, aes(x=volume_retrait.cat, y=ecart_retrait_apoteca)) +
geom_boxplot(fill="red", alpha=0.2)+
geom_hline(yintercept = 5)+
geom_hline(yintercept = -5)

##conclusion erreur de retrait trop importante sur les volumes inférieurs à 10 ml
##Influence du volume de retrait sur ecart entre concentration final mesurée et théorique
ggplot(retrait, aes(x=volume_retrait.cat, y=ecart_hplc_cg)) +
geom_boxplot(fill="green", alpha=0.2)+
geom_hline(yintercept = 5)+
geom_hline(yintercept = -5)

##Influence du volume de retrait sur ecart entre poids final mesuré et théorique
ggplot(retrait, aes(x=volume_retrait.cat, y=ecart_gravi_ext)) +
geom_boxplot(fill="blue", alpha=0.2)+
geom_hline(yintercept = 5)+
geom_hline(yintercept = -5)

##corrélation entre gravi_externe et ecart hplc
mod<-(lm(ecart_gravi_ext~ecart_hplc_cg, data=retrait))
summary(mod)
##
## Call:
## lm(formula = ecart_gravi_ext ~ ecart_hplc_cg, data = retrait)
##
## Residuals:
## Min 1Q Median 3Q Max
## -10.2631 -0.0907 0.0708 0.2240 1.5045
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.69587 0.05887 -11.82 <2e-16 ***
## ecart_hplc_cg 0.06214 0.02679 2.32 0.0213 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7786 on 208 degrees of freedom
## Multiple R-squared: 0.02522, Adjusted R-squared: 0.02053
## F-statistic: 5.381 on 1 and 208 DF, p-value: 0.02132
mod%>%tbl_regression(intercept = TRUE)
| Characteristic |
Beta |
95% CI |
p-value |
| (Intercept) |
-0.70 |
-0.81, -0.58 |
<0.001 |
| Ecart entre concentration finale et concentration théorique (recalcul par CG) |
0.06 |
0.01, 0.11 |
0.021 |
##representation graphique correlation ecart apoteca vs gravi externe selon volume poche
ggplot( retrait , aes(x=ecart_gravi_ext, y=ecart_hplc, color=as.factor(volume_solvant) )) +
geom_point(size=3) +
geom_smooth(method=lm , color="red", se=FALSE) +
geom_vline(xintercept = 5)+
geom_vline(xintercept = -5)+
geom_hline(yintercept = 5)+
geom_hline(yintercept = -5)+
facet_wrap(~volume_solvant) +
theme(legend.position="none")
## `geom_smooth()` using formula = 'y ~ x'

##conclusion, les petits volumes de retraits sont imprécis, mais sans impact sur le résultat final de la poche
## Le résultat final est correct en gravimétrie, résultat confirmé par HPLC
## peu de corrélation entre ecart observé sur gravimétrie et ecart analytique
##performance sur les seringues
seringues<-filter(stats_apoteca, c(eligible_seringues=="oui"))
##correlation entre ecart apoteca et gravi externe
mod<-(lm(ecart_gravi_ext~ecart_apoteca, data=seringues))
summary(mod)
##
## Call:
## lm(formula = ecart_gravi_ext ~ ecart_apoteca, data = seringues)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.7096 -0.6435 -0.2123 0.5274 2.2761
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.02056 0.13018 -0.158 0.875
## ecart_apoteca 0.66648 0.09501 7.015 4.53e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1 on 88 degrees of freedom
## Multiple R-squared: 0.3586, Adjusted R-squared: 0.3513
## F-statistic: 49.21 on 1 and 88 DF, p-value: 4.526e-10
mod%>%tbl_regression(intercept = TRUE)
| Characteristic |
Beta |
95% CI |
p-value |
| (Intercept) |
-0.02 |
-0.28, 0.24 |
0.9 |
| ecart_apoteca |
0.67 |
0.48, 0.86 |
<0.001 |
##boxplots selon variables
seringues$volume_dci.cat<-factor(seringues$volume_dci)
g1<-ggplot(seringues, aes(x=volume_dci.cat, y=ecart_gravi_ext)) +
geom_boxplot(fill="green", alpha=0.2)+
geom_hline(yintercept = 5)+
geom_hline(yintercept = -5)
g2<-ggplot(seringues, aes(x=volume_dci.cat, y=ecart_apoteca)) +
geom_boxplot(fill="red", alpha=0.2)+
geom_hline(yintercept = 5)+
geom_hline(yintercept = -5)
plot_grid(g1, g2)

##Performance reconstitution
reconstitution<-filter(stats_apoteca, c(eligible_recsontitution=="oui"))
##correlation entre ecart apoteca et gravi externe
mod<-(lm(ecart_gravi_ext~ecart_apoteca, data=reconstitution))
summary(mod)
##
## Call:
## lm(formula = ecart_gravi_ext ~ ecart_apoteca, data = reconstitution)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.38706 -0.15366 -0.03206 0.10235 0.61102
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.2339 0.1025 2.281 0.0279 *
## ecart_apoteca 0.5808 0.0923 6.293 1.83e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2208 on 40 degrees of freedom
## Multiple R-squared: 0.4975, Adjusted R-squared: 0.485
## F-statistic: 39.61 on 1 and 40 DF, p-value: 1.829e-07
mod%>%tbl_regression(intercept = TRUE)
| Characteristic |
Beta |
95% CI |
p-value |
| (Intercept) |
0.23 |
0.03, 0.44 |
0.028 |
| ecart_apoteca |
0.58 |
0.39, 0.77 |
<0.001 |
##boxplots selon variables
g1<-ggplot(reconstitution, aes(x=volume_dci, y=ecart_gravi_ext)) +
geom_boxplot(fill="green", alpha=0.2)+
geom_hline(yintercept = 5)+
geom_hline(yintercept = -5)
g2<-ggplot(reconstitution, aes(x=volume_dci, y=ecart_apoteca)) +
geom_boxplot(fill="red", alpha=0.2)+
geom_hline(yintercept = 5)+
geom_hline(yintercept = -5)
plot_grid(g1, g2)
