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.

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

Brandon LeBeau

University of Iowa

Overview

R

  • R is an open source statistical programming language.
    • Pros:
      • Common statistical procedures are found in R
      • Can extend functionality with packages/functions
    • Cons:
      • Need to be comfortable with code

Reproducible Research

  • Reproducible research has become popular.
    • Commonly a document that contains both analysis and text.
    • This can be done with Rmarkdown and knitr.

Iterative/Interactive Data Analysis

  • This type of analysis requires some input from the user.
    • Data analysts may use R
    • Shiny is a great option for code novices

Iterative Task Examples

  • Building Assessments
  • Exploratory Data Analysis
  • Exploring Missing Data Patterns
  • Model Selection/Building

Iterative Analysis Structure

What is Shiny?

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

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")  
      )

    )
  )
)

Server File

shinyServer(function(input, output) {

  output$phonePlot <- renderPlot({

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

Interactivity is Key

Tools for Interactivity

  • Interactive Graphics
    • Using JavaScript - D3 graphics (rCharts)
    • Interactive static graphics - Garrett's presentation
  • Interactive Tables
    • Using DT R package

Reporting from Shiny

  • Using Rmarkdown and knitr to create customizable reproducible reports
    • Example: generate report button
  • Generate final data files
    • Example: download data button

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

Weaknesses of Using Shiny

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

Background for Demo

  • In educational assessment, we need to create new test forms
    • Exposure concerns
    • Add new content
    • Altering test landscape
  • Building test forms is an iterative process that involves gathering information from:
    • Item analyses
    • Test blueprints
    • Item response theory (IRT)

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

Logistic Curve

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')

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

Weaknesses of Shiny for Iterative Data Analysis

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

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.

Summary

Shiny Resources

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.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)