Interactive Statistical Analysis
for Item Response Theory using Shiny
Hiroko Katayama, Hirotaka Asahara†, Naoki Mizutani‡, Masahiro Kuroda§
and Yuichi Mori**Abstract —It is important to do trial and error by estimating with a variety of parameters and consideringwith different presentations of results in statistical analysis. Here we use Shiny among several development
environments and platforms, which provides interactive operations wish R as a computational engine, todevelop an interactive system on the web so that users can interactively consider the analysis process andresults. We show a Shiny interactive application developed for Item Response Theory as an example.

Keyword: Item Response Theory; Shiny; Interactive Statistical Analysis.

1Introduction

It is important to do trial and error by estimating with a variety of parameters and considering withdifferent presentations of results in statistical analysis. For example, in Katayama et al. (2016) where Item
Response Theory (IRT) is used to analyze students’ images, it often occurs that we wish to know which
items are extracted by changing the range of item’s discrimination and difficulty. When we use R in thiscase, it generally takes time and efforts because we have to re-input commands to get the results, eventhough R is now very popular. It is very desirable if an interactive system is provided especially in a casewhere users are not familiar with statistical packages. Although there exist many development
environments and platforms, we use Shiny package among them, which enables us to operate the analysis
interactively and utilizes R as a computational engine, to develop an interactive system on the Web sothat users can interactively consider the analysis process and results.
2IRT with the interactivityIRT is a method to estimate the discrimination (aj) and the difficulty (bj) of the j-th item (problem/question) based on P( i )1, where P(i ) is the probability of positive1  exp [1.7a j ( i  b j )]response and i is the latent ability of the i-th examinee. In the analysis, when the number of items islarge, we cannot sometimes observe the characteristics of specific items because many item characteristic
curves (ICCs) overlap each other and therefore the characteristic of each item cannot be identified. For
such case, we wish to extract specific items from the cloud of ICCs, that is, we wish to consider thecharacteristics for items whose discrimination and difficulty are larger than the specific value or within
the specific range of value. To do this, we have to generally repeat the same analysis by varying thevalues. If interactive interfaces such as check box and slider bar are provided to select items and the range,
we can consider the characteristics with only necessary items without the repeatable executions.
Graduate School of Okayama University of Science, 1-1 Ridai-cho, Kita-ku, Okayama 700-0005, Japan, E-mail:hk22@pub.ous.ac.jp, Tel: +81-86-256-9781† Graduate School of Okayama University of Science, 1-1 Ridai-cho, Kita-ku, Okayama 700-0005, Japan, E-mail:,i16vm01@ous.jp Tel: +81-86-256-9652‡ Okayama University of Science, 1-1 Ridai-cho, Kita-ku, Okayama 700-0005, Japan, E-mail: mizutani@soci.ous.ac.jp, Tel:
+81-86-256-9442§ Okayama University of Science, 1-1 Ridai-cho, Kita-ku, Okayama 700-0005, Japan, E-mail: kuroda@soci.ous.ac.jp, Tel:
+81-86-256-9741** Okayama University of Science, 1-1 Ridai-cho, Kita-ku, Okayama 700-0005, Japan, E-mail: mori@soci.ous.ac.jp, Tel:
+81-86-256-9652

3Shiny

Shiny provided on http://shiny.rstudio.com/ is an R package with powerful interfaces. From “Shiny
Tutorial” on http://rstudio.github.io/shiny/tutorial/ (RStudio, Inc., 2013), the features of Shiny are as
follows: We can build useful web applications with only a few lines of code and without otherprogramming languages such as Java script. Shiny applications work in any R environment such as
console R, Rgui for Windows, Mac or Linux and Rstudio. Fast bidirectional communication between theweb browser and R is realized. They are automatically “live” in the same way that spreadsheets are live,that is, outputs change instantly as users modify inputs without requiring a reload of the browser. Shinyuser interfaces can be built using R and can be written directly in HTML, CSS, and Java script for more
flexibility. More attractive user interfaces also can be implemented based on Twitter Bootstrap such as ahighly customizable slider widget with built-in support for animation. A reactive programming model
eliminates messy event handling code, so we can focus on the code that really matters. Developed Shiny
applications can be redistributed so that other developers can easily drop into their own applications.
Thus, Shiny package enables us to make web-based applications by RStudio and all the processes canbe operated on the web interactive interfaces with R as a computational engine.
4Interactive IRT system

For the situation in Section 2, we have developed a Shiny application which provides a web-based
interactive interface to perform trial-and-error type IRT. The implementation and characteristics are asfollows.
4.1 Implementation
・ Shiny on Windows or Linux・ Web-based application
4.2 Characteristics of the system
The Shiny application has the following characteristics:
・ Since the application is run on the web browser, users can use it any place and any time, if it isprovided in the Web.
・ The interactivity is implemented as follows: ICCs that users want to observe can be indicated bychecking the corresponding check boxes. ICCs that have a specific discrimination and/or difficulty
can be indicated by moving the slider bars. The examinee’s ability and correct answer rate for each
item can be visualized.
4.3 Actual analysis using the application
Our Shiny application consists of mainly four functions: data input, item selection, interactive analysis on
the results, and individual’s ability details. The application runs on the web browser or the web-styleinterface.
Figure 1 shows that screenshot of data input: Clicking the first option in the left hand-side menu (mainmenu), the file selection box with file attribute options (sub menu) appears at the right of the main menu.
By selecting data, the content of the data is automatically displayed. The data here is 1302 student’s
scores of mathematics examination with 25 problems.
Figure 2 indicates the selection window to select items to be selected. Clicking the second option in themain menu, the list of items (problems/questions) appears in the sub menu. You can select any items you
wish to analyze by checking the corresponding check boxes. Clicking the [Set] button, the selected items
are analyzed by IRT and their ICCs are drawn on the next window (Figure 3)
Figure 3 indicates the result window which displays the corresponding ICCs in the plot area and theirdiscriminations and difficulties at the right of the plot. You can see two slider bars at the right-top corner.
Two bullets on each bar are moved to specify the range of discrimination (upper bar) and difficulty (lowerbar). According to the slider bars’ movement, the ICCs within/without the range are instantlyappearing/disappearing. This function is very convenient to observe the items and their ICCs which areFigure 1: Data input.

Figure 2: Item selection.

Figure 3: Interactive analysis on the results.

Figure4: Individual’s ability details.

within the specific range.
Figure 4 shows examinee’s latent ability and the bar chart that indicates examinee’s estimated correct
answer rate for each item so as to observe positive and negative response more visually. The bar iscolored in blue and in red when the real answer is correct (the real rate=1) and wrong (the real rate=0),respectively, and the length of the bar presents diff, where diff = (real rate) – (estimated rate), which
evaluates the difference between real rate and estimated rate for each item.
5Concluding remarks

In order to make it possible to do trial and error in IRT analysis, we have developed a statisticalapplication with Shiny package. This application makes us interactively to apply IRT to any items,
observe items and ICCs which have specific discrimination and difficulty, and visualize examinee’sability and correct answer rate for each item. This prototype of application can be extended to use in otherstatistical methods.

References[1] Katayama, H., Asahara, H., Kuroda, M., Mizutani, N., Mori, Y. (2016). Analysis of questionnaire data
by Item Response Theory, Journal of Socio Information Studies, 16, 37-48. (in Japanese)[2] Shiny by Studio. http://shiny.rstudio.com/ (2016/6/13).
[3] Shiny Tutorial. http://rstudio.github.io/shiny/tutorial (2016/9/8).