Site icon R-bloggers

Interactively building test forms from an IRT perspective An application of R and Shiny

[This article was first published on Educate-R - R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

< section>

Interactively building test forms from an IRT perspective: An application of R and Shiny

Brandon LeBeau

University of Iowa

< section>

Overview

< section>

R

< section>

Reproducible Research

< section>

Iterative/Interactive Data Analysis

< section>

Iterative Task Examples

< section>

Iterative Analysis Structure

< section>

What is Shiny?

< section>

Components of Shiny

  1. User Interface (ui.r)
    • What the user sees and interacts with
  2. R Analysis (server.r)
    • The R code running behind the scenes

< section>

User Interface

shinyUI(

  fluidPage(    

    titlePanel("Telephones by region"),

    sidebarLayout(      

      sidebarPanel(
        selectInput("region", "Region:", 
                    choices = colnames(WorldPhones)),
        hr(),
        helpText("Data from AT&T (1961) The World's Telephones.")
      ),

      mainPanel(
        plotOutput("phonePlot")  
      )

    )
  )
)

< section>

Server File

shinyServer(function(input, output) {

  output$phonePlot <- renderPlot({

    barplot(WorldPhones[ , input$region] * 1000, 
            main = input$region,
            ylab = "Number of Telephones",
            xlab = "Year")
  })
})

< section>

Interactivity is Key

< section>

Tools for Interactivity

< section>

Reporting from Shiny

< section>

Strengths of Using Shiny

  1. The app can be written solely using R code
    • Can use CSS, JavaScript, or HTML as needed
  2. User does not need to know any R
  3. Many hosting options
  4. Application can be as simple or complex as needed (both visually and functionally)
  5. Flexible output

< section>

Weaknesses of Using Shiny

  1. May take more time to develop initially
  2. Need some R familiarity for development

< section>

Background for Demo

< section>

IRT Data

##      Item.1 Item.2 Item.3 Item.4 Item.5 Item.6 Item.7 Item.8
## [1,]      1      1      1      1      1      1      1      1
## [2,]      0      1      0      0      1      0      1      0
## [3,]      1      1      1      0      1      0      1      0
## [4,]      0      1      0      1      1      0      1      0
## [5,]      0      1      1      1      1      0      1      1
## [6,]      1      1      0      0      1      0      1      0

< section>

Logistic Curve

< section>

Demo

https://github.com/lebebr01/BuildForm

# Basic Theme
shiny::runGitHub('lebebr01/BuildForm', subdir = 'R', ref = 'basic')

# shinydashboard
shiny::runGitHub('lebebr01/BuildForm', subdir = 'R', ref = 'testmodule')

< section>

Benefits of Shiny for Iterative Data Analysis

  1. Free valuable data analyst/scientist resources.
  2. Improve data literacy in the organization.
  3. Highly customizable
    • Analysis (server.r)
    • User interface (ui.r)
    • Reporting

< section>

Weaknesses of Shiny for Iterative Data Analysis

  1. Need to train users
    • Analysis
    • Navigating web application
  2. Knowledge of JavaScript, CSS, or HTML useful.

< section>

Guidelines for Building Shiny Apps

  1. Understand reactive coding.
  2. Modularize your code – define functions for repetitive code chunks.
  3. Define scope early.
    • Define output.
  4. Clean up UI last.

< section>

Summary

< section>

Shiny Resources

< section>

Questions?

To leave a comment for the author, please follow the link and comment on their blog: Educate-R - R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.