Montag, 19. Dezember 2016

R: Clinical Trial Simulator

The first version of the clinical trial simulator is online now.

It uses a dose-response model based on the Hill equation which basically is a saturation model. The assumption is that a cell is covered by a finite number of receptors. When the treatment is applied, a fraction of the receptors (depending on the dosage) is interacting with the treatment molecule and every interaction leads to a response. When every receptor is binding to the treatment, the response saturates.

It's based on the MSToolkit package and is hosted online at shiny apps under

https://mzhku.shinyapps.io/trialsim/

Sonntag, 4. Dezember 2016

R: Sample Size Calculator

Given a beta, how many patients need to be enrolled in a two-armed study of conventional against experimental therapy? Significance is set to 0.05, recruitment period and follow-up period can be defined together with median disease free survival times for the two study groups (implemented in R/Shiny):

Github repository

Try it (also mobile)!
https://mzhku.shinyapps.io/size/

R Shiny: Some reactivity by example

Start R from the directory containing ui.r and server.r, import the shiny library and start the (development) server using runApp().

server.r

function(input, output) {
rv <- reactiveValues()

# Only modify and output reactive input
output$numOut1 <- renderText({ input$n+10
})

# Modify, reassign and output reactive input.
output$numOut2 <- renderText({ rv$a <- input$n+20 }) # Use modified reactive input, modify and output. output$num1 <- renderText({
rv$s <- rv$a+runif(1)
})

# Assign reactive input locally, modify locally, print.
output$num2 <- renderText({ k <- input$n
paste(as.character(runif(1)), "here", k-10)
})

# Use reactive value from another reactive function,
# modify and print.
output$let <- renderText({ paste(as.character(rv$s), sample(letters, 1), sep="")
})

}

ui.r

fluidPage(
numericInput(inputId="n", "Shiny Reactivity Example", value=25),

textOutput(outputId="numOut1"),

textOutput(outputId="numOut2"),

textOutput(outputId="num1"),
textOutput(outputId="num2"),
textOutput(outputId="let")
)