# Shiny Application for expertsurv

R packages have many advantages, primarily allowing for easy sharing and documentation of code and ensuring code follows standardised conventions. Although R packages are more user friendly than a collection of functions, they still require the user to have a working knowledge of R something which most experts will not have.

As noted by (Mikkola et al. 2023), there is a need for tools which can embed the elicitation of expert opinion within the statistical workflow. One such tool is Shiny, an open-source R package that provides an elegant and powerful web framework for building web applications using R. Shiny can turn analyses conducted by R into interactive web applications without requiring HTML, CSS, or JavaScript knowledge (Chang et al. 2023).

Learning how to interact with a webpage should be a much simpler task for experts and health economists not familiar with R. Furthermore, we can leverage R Markdown to create reproducible reports of the relevant outputs of the \(\texttt{expertsurv}\) package in formats such as PDF, HTML and Word.

The tutorial below provides an overview of the steps required to elicit expert opinion on the survival at a timepoint of 20 months and incorporate these beliefs with survival data. To begin we simply run the following function \(\texttt{elicit_surv}()\) which will open up a webpage.

In Figure @ref(fig:expertsurv-1) we have the following steps to upload the data:

1. Upload an Excel file containing the survival data.
2. Select the columns referring to the time, status, and arm (if jointly modelling treatment and comparator).
3. Set the limit for the survival plot (ensuring that ‘Choose opinion type’ is ‘Survival at timepoint(s)’).
4. We assume that there are two experts who will provide expert opinion.
5. Once the above parameters are defined, select ‘Plot/Update Survival Curves and Expert Opinions’.

Upload data and generate Kaplan-Meier plot

In Figure @ref(fig:expertsurv-2) we have the following steps to elicit the expert’s opinions:

1. We set the timepoint at which we elicit expert opinion to 20 months.
2. Experts will be asked for their beliefs on the median survival at 20 months, the lower \(2.5\%\) and upper \(97.5\%\) probabilities of the population survival.

Once these steps are complete, we click the ‘’Plot/Update Survival Curves and Expert Opinions’’ button.

Expert beliefs about survival at 20 months

In Figure @ref(fig:expertsurv-2) we have the following steps to run the analysis:

1. Several other advanced options relating to the expert opinion are available in the checkbox; these include specifying the most likely value (MLV), the choice of pooling expert opinion (linear or logarithmic pooling - default linear pooling) and the parametric distribution to fit to each individual opinion (default is best fitting).
2. We can select which treatment arm relates to the expert’s belief (i.e. treatment or comparator).
3. Selecting Run Analysis will conduct the analysis; and it should be noted that the Bayesian analysis can take a considerable amount of time.
4. Once the analysis is complete we can download the \(\texttt{expertsurv}\) object which can be loaded an R session later.
5. We can also download the results as a report in one of three formats (HTML, PDF or Word) as shown in Figure @ref(fig:expertsurv-4).

Running statistical analysis

Results generated from the Markdown file

# References

Chang, Winston, Joe Cheng, JJ Allaire, Carson Sievert, Barret Schloerke, Yihui Xie, Jeff Allen, Jonathan McPherson, Alan Dipert, and Barbara Borges. 2023. “Shiny: Web Application Framework for r.” https://shiny.posit.co/.
Mikkola, Petrus, Osvaldo A. Martin, Suyog Chandramouli, Marcelo Hartmann, Oriol Abril Pla, Owen Thomas, Henri Pesonen, et al. 2023. “Prior Knowledge Elicitation: The Past, Present, and Future.” Bayesian Analysis, 1–33. https://doi.org/10.1214/23-BA1381.