---
title: "OUTMEDIC-FR"
subtitle: "Rapport statistique -- V1"
author: 
    - name: "Dr Philippe MICHEL"
      affiliations:
        name: "Hôpital NOVO"
        department: "Unité de Soutien à la Recherche Clinique"
lang: fr-FR
date: today
date-format: "DD/MM/YYYY"
format: 
  titlepage-pdf:
    titlepage: bg-image
    titlepage-bg-image: "novo_usrc.png"
    logo-space-after: "0\\baselineskip"
    documentclass: scrreprt
    classoption: ["oneside", "open=any"]
    number-sections: true
    titlepage-footer: "**Christophe ANTONIAZZI** \\newline  Filière gériatrique -- Hôpital NOVO (Site Pontoise)\\newline \\newline Description des freins à la déprescription des patients français de plus de 75 ans pris en charge dans la filière gériatrique hospitalière \\newline Étude transversale non interventionnelle, multicentrique et prospective"
titlepage-theme:
    title-fontstyle: ["Huge", "bfseries"]
    title-color: novo
    subtitle-color: novo
    subtitle-fontstyle: ["huge"]
    logo-size: "0.2\\textheight"
    vrule-width: "0.1cm"
    vrule-color: novo
include-in-header:
      text: |
        \definecolor{novo}{HTML}{27484b}
jss-pdf:
    keep-tex: true   
pdf-engine: lualatex
keep-tex: true
number-sections: true
toc: true
lof: true
lot: true
mainfont: Faune
mainfontoptions:
  - Numbers=OldStyle
  - Ligatures=TeX
sansfont: Myriad Pro
sansfontoptions:
  - Ligatures=TeX
fig-cap-location: bottom
tbl-cap-location: top
classoption: [french]
papersize: a4paper
editor: source
bibliography: stat.bib
cite-method: biblatex
csl: jama.csl
#reference-location: margin
#citation-location: margin
license: "CC BY-SA"
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE, cache = TRUE) 
expx <- FALSE
classeur <- "outmedic1.xls"
```

```{r}
#| label: lib

library(baseph)
library(janitor)
library(corrplot)
library(tidyverse)
library(lubridate)
library(labelled)
library(kableExtra)
library(forestmodel)
library(epiDisplay)
library(confintr)
library(colorspace)
library(DataExplorer)
library(gtsummary)
library(survminer)
```

```{r}
#| label: likert

likert <- function(zz){
zz <- zz %>%
  fct_relevel(
    "tout à fait d'accord", "d'accord", "incertain", "pas d'accord",
    "pas du tout d'accord"
  )
}
```


```{r}
#| label: import

tt <- read_csv("data/Outmedic-fr1.csv", na = c("NA", "nk"," ", "","na"),show_col_types = FALSE) |> 
    mutate_if(is.character,as.factor) |> 
    janitor::clean_names() |> 
    mutate(id = paste0(num_centre, "-",num_patient )) |> 
    select(-c(1:4)) |> 
    relocate(id) |>
  mutate_at(c(7:30,32:33),likert)
```



## Description de la population

```{r}
#| label: desc1
#| tbl-cap: Tableau descriptif - Démographique

tt |> 
    select(43:47) |> 
    tbl_summary(missing = "no") |> 
    modify_header(label ~ " ") |>
    bold_labels() |> 
    add_n() |> 
   exptabph(lg = FALSE, exp = expx, nomfich = classeur, nomsheet = "descdemog")
    
```

```{r}
#| label: desc2
#| tbl-cap: Tableau descriptif - Ordonnance

tt |> 
    select(2:6) |> 
    tbl_summary(missing = "no") |> 
    modify_header(label ~ " ") |>
    bold_labels() |> 
    add_n() |> 
   exptabph(lg = FALSE, exp = expx, nomfich = classeur, nomsheet = "descord")
    
```

```{r}
#| label: desc3
#| tbl-cap: Tableau descriptif - Fardeau

tt |> 
    select(7:11) |> 
    tbl_summary(missing = "no") |> 
    modify_header(label ~ " ") |>
    bold_labels() |> 
    add_n() |> 
   exptabph(lg = FALSE, exp = expx, nomfich = classeur, nomsheet = "descfardo")
```

```{r}
#| label: desc4
#| tbl-cap: Tableau descriptif - Pertinence

tt |> 
    select(12:16) |> 
    tbl_summary(missing = "no") |> 
    modify_header(label ~ " ") |>
    bold_labels() |> 
    add_n() |> 
   exptabph(lg = FALSE, exp = expx, nomfich = classeur, nomsheet = "descpertinenc")
```
```{r}
#| label: desc5
#| tbl-cap: Tableau descriptif - Inquiétude

tt |> 
    select(17:21) |> 
    tbl_summary(missing = "no") |> 
    modify_header(label ~ " ") |>
    bold_labels() |> 
    add_n() |> 
   exptabph(lg = FALSE, exp = expx, nomfich = classeur, nomsheet = "descfardo")
```

```{r}
#| label: desc6
#| tbl-cap: Tableau descriptif - Fardeau

tt |> 
    select(17:21) |> 
    tbl_summary(missing = "no") |> 
    modify_header(label ~ " ") |>
    bold_labels() |> 
    add_n() |> 
   exptabph(lg = FALSE, exp = expx, nomfich = classeur, nomsheet = "descfardo")
```

## Critère principal



## Technique {.appendix}

Les données discrètes ont été présentés en pourcentage puis comparées par un test exact de Fisher. Les données numériques ont été présentées par leur médiane & les quartiles puis comparées par le test non paramétrique de Wilcoxon. 

L'analyse multivarié a été menée en régression logistique. Les conditions d'utilisation d'une loi binomiale (distribution normale des résidus) n'étant pas remplies une loi quasi-binomiale a été utilisée. 

La survie à 28 jours a été évaluée par un test du $\chi^2$ de Dunnet & Gent [@dunnet] en unilatéral plus adapté à une analyse de non infériorité.

Les survie ont été calculées par la méthode de Kaplan-Meyer puis  un test non-paramétrique du Log-rank en unilatéral a été tenté.

Pour l'analyse multivariée,  dans un premier temps on incorpore dans l'analyse multivariée tous les facteurs ayant une p-value < 20 %. Ensuite on recherche le meilleur modèle par un step-by-step descendant.

L'analyse statistique a été réalisée avec le logiciel **R** [@rstat] & diverses librairies en particulier celles du `tidyverse` [@tidy] & `epiDisplay` [@epid].
