library(shiny)
library(shinyAce)
library(psych)
library(CTT)
library(ltm)
library(beeswarm)
library(parallel)
shinyServer(function(input, output) {
options(warn=-1)
#######################################################
# Dichotomous Models
#######################################################
bs <- reactive({
dat <- read.csv(text=input$text1, sep="\t")
total <- rowSums(dat, na.rm=T)
result <- describe(total)[2:13]
row.names(result) <- "Total "
result
})
output$textarea.out <- renderPrint({
bs()
})
alpha.result <- reactive({
dat <- read.csv(text=input$text1, sep="\t")
brownRpbi <- function(data,missing) {
m <- mean(rowSums(data))
sd <- sd(rowSums(data))
totalDat <- cbind(data,rowSums(data))
sortDat <- totalDat[order(-totalDat[,length(totalDat)]),]
r <- c()
itemD <- c()
rownames(sortDat) <- c(1:nrow(sortDat))
highDat <- head(sortDat,nrow(sortDat) %/% 3)
lowDat <- tail(sortDat,nrow(sortDat) %/% 3)
for (i in 1:length(data)) {
if (is.element(colnames(data)[i], missing) == F ) {
mhigh <- mean(subset(totalDat[,length(totalDat)],(data[,i] == 1)))
mlow <- mean(subset(totalDat[,length(totalDat)],(data[,i] == 0)))
imean <- mean(data[,i])
itemD <- c(itemD,round((mean(highDat[,i]) - mean(lowDat[,i])),3))
rtemp <- round(cor(data[,i],totalDat[,ncol(totalDat)]),3)
r <- c(r,rtemp)
}
}
pbiDF <- data.frame(itemD, r)
colnames(pbiDF) <- c("ID", "r")
return(pbiDF)
}
myAlpha <- function(data) {
alphaRes <- reliability(data, itemal = T)
if (length(alphaRes$N_person) == 0) {
n <- sprintf("%d",alphaRes$nPerson)
items <- sprintf("%d",alphaRes$nItem)
mean <- sprintf("%.2f",round(alphaRes$scaleMean,2))
sd <- sprintf("%.2f",round(alphaRes$scaleSD,2))
alpha <- substring(sprintf("%.3f",round(alphaRes$alpha,3)),2,5)
} else {
n <- sprintf("%d",alphaRes$N_person)
items <- sprintf("%d",alphaRes$N_item)
mean <- sprintf("%.2f",round(alphaRes$scale.mean,2))
sd <- sprintf("%.2f",round(alphaRes$scale.sd,2))
alpha <- substring(sprintf("%.3f",round(alphaRes$alpha,3)),2,5)
}
sumStats <- data.frame(Total=c(n,items,alpha))
rownames(sumStats) <- c("N","Number of items","Cronbach's alpha")
if (length(alphaRes$N_person) == 0) {
dropif <- round(ifelse(is.na(alphaRes$alphaIfDeleted),0,alphaRes$alphaIfDeleted),3)
r.drop <- round(ifelse(is.na(alphaRes$pBis), 0, alphaRes$pBis),3)
item.mean <- round(alphaRes$itemMean,3)
itemStats <- data.frame(dropif,r.drop,item.mean)
rownames(itemStats) <- colnames(data)
} else {
dropif <- round(ifelse(is.na(alphaRes$alpha.if.deleted),0,alphaRes$alpha.if.deleted),3)
r.drop <- round(ifelse(is.na(alphaRes$pbis), 0, alphaRes$pbis),3)
item.mean <- round(alphaRes$item.mean,3)
itemStats <- data.frame(dropif,r.drop,item.mean)
rownames(itemStats) <- attr(alphaRes$item.mean,"names")
}
colnames(itemStats) <- c("Drop if","r dropped","IF")
itemStats2 <- cbind(itemStats,brownRpbi(data,c()))
itemStats <- itemStats2[,c(1, 2, 5, 3, 4)]
return(list(sumStats,itemStats))
}
myAlpha(dat)
})
output$alpha.result.out <- renderPrint({
alpha.result()
})
data <- reactive({
dat <- read.csv(text=input$text1, sep="\t")
options(digits=3)
if (input$type == "1PL") {
result <- rasch(dat)
est <- factor.scores(result, resp.pattern=dat)
list(result = result, est = est)
} else if (input$type == "2PL") {
result <- ltm(dat ~ z1)
est <- factor.scores(result, resp.pattern=dat)
list(result = result, est = est)
} else {
result <- tpm(dat)
est <- factor.scores(result, resp.pattern=dat)
list(result = result, est = est)
}
})
item.est <- reactive({
if (input$type == "1PL") {
est <- data()$est
i.est <- est$coef
i.est
} else if (input$type == "2PL") {
est <- data()$est
i.est <- est$coef
i.est
} else {
est <- data()$est
i.est <- est$coef
i.est
}
})
output$item.est.out <- renderPrint({
item.est()
})
person.est <- reactive({
if (input$type == "1PL") {
est <- data()$est
p.est <- data.frame(est$score.dat$z1, est$score.dat$se.z1)
colnames(p.est) <- c("Theta", "SE")
round(p.est, 3)
} else if (input$type == "2PL") {
est <- data()$est
p.est <- data.frame(est$score.dat$z1, est$score.dat$se.z1)
colnames(p.est) <- c("Theta", "SE")
round(p.est, 3)
} else {
est <- data()$est
p.est <- data.frame(est$score.dat$z1, est$score.dat$se.z1)
colnames(p.est) <- c("Theta", "SE")
round(p.est, 3)
}
})
output$person.est.out <- renderPrint({
person.est()
})
# Item characteristic curves (ICC) Plot
makeICC <- function(){
if (input$type == "1PL") {
result <- data()$result
plot.rasch(result)
} else if (input$type == "2PL") {
result <- data()$result
plot.ltm(result)
} else {
result <- data()$result
plot.tpm(result)
}
}
output$ICC <- renderPlot({
print(makeICC())
})
# IIC
makeIIC <- function(){
if (input$type == "1PL") {
result <- data()$result
plot.rasch(result, type="IIC")
} else if (input$type == "2PL") {
result <- data()$result
plot.ltm(result, type="IIC")
} else {
result <- data()$result
plot.tpm(result, type="IIC")
}
}
output$IIC <- renderPlot({
print(makeIIC())
})
# TIC
makeTIC <- function(){
if (input$type == "1PL") {
result <- data()$result
plot.rasch(result, type="IIC", items=0)
} else if (input$type == "2PL") {
result <- data()$result
plot.ltm(result, type="IIC", items=0)
} else {
result <- data()$result
plot.tpm(result, type="IIC", items=0)
}
}
output$TIC <- renderPlot({
print(makeTIC())
})
makedistPlot <- function(){
x <- read.csv(text=input$text1, sep="\t")
x <- rowSums(x, na.rm=T)
simple.bincount <- function(x, breaks) {
nx <- length(x)
nbreaks <- length(breaks)
counts <- integer(nbreaks - 1)
for (i in 1:nx) {
lo <- 1
hi <- nbreaks
if (breaks[lo] <= x[i] && x[i] <= breaks[hi]) {
while (hi - lo >= 2) {
new <- (hi + lo) %/% 2
if(x[i] > breaks[new])
lo <- new
else
hi <- new
}
counts[lo] <- counts[lo] + 1
}
}
return(counts)
}
nclass <- nclass.FD(x)
breaks <- pretty(x, nclass)
counts <- simple.bincount(x, breaks)
counts.max <- max(counts)
h <- hist(x, las=1, breaks="FD", xlab= "Red vertical line shows the mean.",
ylim=c(0, counts.max*1.2), main="", col = "cyan")
rug(x)
abline(v = mean(x), col = "red", lwd = 2)
xfit <- seq(min(x), max(x))
yfit <- dnorm(xfit, mean = mean(x), sd = sd(x))
yfit <- yfit * diff(h$mids[1:2]) * length(x)
lines(xfit, yfit, col = "blue", lwd = 2)
}
output$distPlot <- renderPlot({
print(makedistPlot())
})
makeboxPlot <- function(){
x <- read.csv(text=input$text1, sep="\t")
x <- rowSums(x, na.rm=T)
boxplot(x, horizontal=TRUE, xlab= "Mean and +/-1 SD are displayed in red.")
beeswarm(x, horizontal=TRUE, col = 4, pch = 16, add = TRUE)
points(mean(x), 0.9, pch = 18, col = "red", cex = 2)
arrows(mean(x), 0.9, mean(x) + sd(x), length = 0.1, angle = 45, col = "red")
arrows(mean(x), 0.9, mean(x) - sd(x), length = 0.1, angle = 45, col = "red")
}
output$boxPlot <- renderPlot({
print(makeboxPlot())
})
info1 <- reactive({
info1 <- paste("This analysis was conducted with ", strsplit(R.version$version.string, " \\(")[[1]][1], ".", sep = "")# バージョン情報
info2 <- paste("It was executed on ", date(), ".", sep = "")# 実行日時
cat(sprintf(info1), "\n")
cat(sprintf(info2), "\n")
})
output$info1.out <- renderPrint({
info1()
})
#######################################################
# Polytomous Models
#######################################################
bs.poly <- reactive({
x <- read.csv(text=input$text2, sep="\t")
result <- describe(x)
total <- rowSums(x, na.rm=T)
result1 <- describe(total)[2:13]
y <- rowMeans(x, na.rm=T)
result2 <- describe(y)[2:13]
row.names(result1) <- "Total"
row.names(result2) <- "Average"
return(list(result2, result1, result))
})
output$bs.poly.out <- renderPrint({
bs.poly()
})
makedistPlot2 <- function(){
x <- read.csv(text=input$text2, sep="\t")
if (input$meantotal1 == "mean1") {
x <- rowMeans(x, na.rm=T)
} else {
x <- rowSums(x, na.rm=T)
}
simple.bincount <- function(x, breaks) {
nx <- length(x)
nbreaks <- length(breaks)
counts <- integer(nbreaks - 1)
for (i in 1:nx) {
lo <- 1
hi <- nbreaks
if (breaks[lo] <= x[i] && x[i] <= breaks[hi]) {
while (hi - lo >= 2) {
new <- (hi + lo) %/% 2
if(x[i] > breaks[new])
lo <- new
else
hi <- new
}
counts[lo] <- counts[lo] + 1
}
}
return(counts)
}
nclass <- nclass.FD(x)
breaks <- pretty(x, nclass)
counts <- simple.bincount(x, breaks)
counts.max <- max(counts)
h <- hist(x, na.rm= T, las=1, breaks="FD", xlab= "Red vertical line shows the mean.",
ylim=c(0, counts.max*1.2), main="", col = "cyan")
rug(x)
abline(v = mean(x, na.rm=T), col = "red", lwd = 2)
xfit <- seq(min(x, na.rm=T), max(x, na.rm=T))
yfit <- dnorm(xfit, mean = mean(x, na.rm=T), sd = sd(x, na.rm=T))
yfit <- yfit * diff(h$mids[1:2]) * length(x)
lines(xfit, yfit, col = "blue", lwd = 2)
}
output$distPlot2 <- renderPlot({
print(makedistPlot2())
})
makeboxPlot2 <- function(){
x <- read.csv(text=input$text2, sep="\t")
if (input$meantotal2 == "mean2") {
x <- rowMeans(x, na.rm=T)
} else {
x <- rowSums(x, na.rm=T)
}
boxplot(x, horizontal=TRUE, xlab= "Mean and +/-1 SD are displayed in red.")
beeswarm(x, horizontal=TRUE, col = 4, pch = 16, add = TRUE)
points(mean(x, na.rm=T), 0.9, pch = 18, col = "red", cex = 2)
arrows(mean(x, na.rm=T), 0.9, mean(x, na.rm=T) + sd(x, na.rm=T), length = 0.1, angle = 45, col = "red")
arrows(mean(x, na.rm=T), 0.9, mean(x, na.rm=T) - sd(x, na.rm=T), length = 0.1, angle = 45, col = "red")
}
output$boxPlot2 <- renderPlot({
print(makeboxPlot2())
})
alpha.result2 <- reactive({
dat <- read.csv(text=input$text2, sep="\t")
brownRpbi <- function(data,missing) {
m <- mean(rowSums(data))
sd <- sd(rowSums(data))
totalDat <- cbind(data,rowSums(data))
sortDat <- totalDat[order(-totalDat[,length(totalDat)]),]
r <- c()
rownames(sortDat) <- c(1:nrow(sortDat))
for (i in 1:length(data)) {
if (is.element(colnames(data)[i], missing) == F ) {
rtemp <- round(cor(data[,i],totalDat[,ncol(totalDat)]),3)
r <- c(r,rtemp)
}
}
pbiDF <- data.frame(r)
colnames(pbiDF) <- c("r")
return(pbiDF)
}
myAlpha <- function(data) {
alphaRes <- reliability(data, itemal = T)
if (length(alphaRes$N_person) == 0) {
n <- sprintf("%d",alphaRes$nPerson)
items <- sprintf("%d",alphaRes$nItem)
mean <- sprintf("%.2f",round(alphaRes$scaleMean,2))
sd <- sprintf("%.2f",round(alphaRes$scaleSD,2))
alpha <- substring(sprintf("%.3f",round(alphaRes$alpha,3)),2,5)
} else {
n <- sprintf("%d",alphaRes$N_person)
items <- sprintf("%d",alphaRes$N_item)
mean <- sprintf("%.2f",round(alphaRes$scale.mean,2))
sd <- sprintf("%.2f",round(alphaRes$scale.sd,2))
alpha <- substring(sprintf("%.3f",round(alphaRes$alpha,3)),2,5)
}
sumStats <- data.frame(Total=c(n,items,alpha))
rownames(sumStats) <- c("N","Number of items","Cronbach's alpha")
if (length(alphaRes$N_person) == 0) {
dropif <- round(ifelse(is.na(alphaRes$alphaIfDeleted),0,alphaRes$alphaIfDeleted),3)
r.drop <- round(ifelse(is.na(alphaRes$pBis), 0, alphaRes$pBis),3)
item.mean <- round(alphaRes$itemMean,3)
itemStats <- data.frame(dropif,r.drop)
rownames(itemStats) <- colnames(data)
} else {
dropif <- round(ifelse(is.na(alphaRes$alpha.if.deleted),0,alphaRes$alpha.if.deleted),3)
r.drop <- round(ifelse(is.na(alphaRes$pbis), 0, alphaRes$pbis),3)
item.mean <- round(alphaRes$item.mean,3)
itemStats <- data.frame(dropif,r.drop)
rownames(itemStats) <- attr(alphaRes$item.mean,"names")
}
colnames(itemStats) <- c("Drop if","r dropped")
itemStats <- cbind(itemStats,brownRpbi(data,c()))
return(list(sumStats,itemStats))
}
myAlpha(dat)
})
output$alpha.result2.out <- renderPrint({
alpha.result2()
})
# Scree Plot
screePlot <- function(){
dat <- read.csv(text=input$text2, sep="\t")
scree(dat)
}
output$screePlot <- renderPlot({
print(screePlot())
})
polydata <- reactive({
dat <- read.csv(text=input$text2, sep="\t")
if (input$model == "gpcm.mdl") {
res.gpcm <- gpcm(dat)
list(est1 = res.gpcm)
} else {
res.grm <- grm(dat, start.val = "random") #2020-1225added
list(est2 = res.grm)
}
})
polyitem.est <- reactive({
if (input$model == "gpcm.mdl") {
est <- polydata()$est1
res <- coef(est)
fit <- data.frame(summary(est)[2:4])
rownames(fit) <- ""
list("Model Summary"=fit, "Coefficients"=res)
} else {
est <- polydata()$est2
res <- coef(est)
fit <- data.frame(summary(est)[2:4])
rownames(fit) <- ""
list("Model Summary"=fit, "Coefficients"=res)
}
})
output$polyitem.est.out <- renderPrint({
polyitem.est()
})
polyperson.est <- reactive({
dat <- read.csv(text=input$text2, sep="\t")
if (input$person == "show.theta") {
if (input$model == "gpcm.mdl") {
est <- polydata()$est1
est <- factor.scores(est, resp.pattern=dat)
p.est <- data.frame(est$score.dat$z1, est$score.dat$se.z1)
colnames(p.est) <- c("Theta", "SE")
round(p.est, 3)
} else {
est <- polydata()$est2
est <- factor.scores(est, resp.pattern=dat)
p.est <- data.frame(est$score.dat$z1, est$score.dat$se.z1)
colnames(p.est) <- c("Theta", "SE")
round(p.est, 3)
}
} else {
cat("No estimation of theta selected.")
}
})
output$polyperson.est.out <- renderPrint({
polyperson.est()
})
# Item characteristic curves (ICC) Plot
makepolyICC <- function(){
dat <- read.csv(text=input$text2, sep="\t")
# From the input of "Indicate which item to plot:"
num <- input$plot.item
if (input$model == "gpcm.mdl") {
est <- polydata()$est1
plot.gpcm(est, items = num)
} else {
est <- polydata()$est2
plot.grm(est, items = num)
}
}
output$polyICC <- renderPlot({
print(makepolyICC())
})
# IIC
makepolyIIC <- function(){
if (input$model == "gpcm.mdl") {
est <- polydata()$est1
plot.gpcm(est, type="IIC")
} else {
est <- polydata()$est2
plot.grm(est, type="IIC")
}
}
output$polyIIC <- renderPlot({
print(makepolyIIC())
})
# TIC
makepolyTIC <- function(){
if (input$model == "gpcm.mdl") {
est <- polydata()$est1
plot.gpcm(est, type="IIC", items=0)
} else {
est <- polydata()$est2
plot.grm(est, type="IIC", items=0)
}
}
output$polyTIC <- renderPlot({
print(makepolyTIC())
})
info2 <- reactive({
info1 <- paste("This analysis was conducted with ", strsplit(R.version$version.string, " \\(")[[1]][1], ".", sep = "")# バージョン情報
info2 <- paste("It was executed on ", date(), ".", sep = "")# 実行日時
cat(sprintf(info1), "\n")
cat(sprintf(info2), "\n")
})
output$info2.out <- renderPrint({
info2()
})
})
library(shiny)
library(shinyAce)
shinyUI(bootstrapPage(
headerPanel("Item Response Theory"),
########## Adding loading message #########
tags$head(tags$style(type="text/css", "
#loadmessage {
position: fixed;
top: 0px;
left: 0px;
width: 100%;
padding: 10px 0px 10px 0px;
text-align: center;
font-weight: bold;
font-size: 100%;
color: #000000;
background-color: #CCFF66;
z-index: 105;
}
")),
conditionalPanel(condition="$('html').hasClass('shiny-busy')",
tags$div("Loading...",id="loadmessage")),
########## Added up untill here ##########
#sidebarPanel(
#br()
#),
mainPanel(
tabsetPanel(
tabPanel("Dichotomous Models",
radioButtons("type", strong("Model selection:"),
list("One-parameter logistic model (1PL)" = "1PL",
"Two-parameter logistic model (2PL)" = "2PL",
"Three-parameter logistic model (3PL)" = "3PL"
), selected = "2PL"
),
br(),
p('Note: Input values (either numeric or character) must be separated by tabs. Copy and paste from Excel/Numbers.'),
p(HTML("<b><div style='background-color:#FADDF2;border:1px solid black;'>Please make sure that your data includes the header (variable names) in the first row.</div></b>")),
aceEditor("text1", value="Q01\tQ02\tQ03\tQ04\tQ05\tQ06\tQ07\tQ08\tQ09\tQ10\tQ11\tQ12\tQ13\tQ14\tQ15\tQ16\tQ17\tQ18\tQ19\tQ20\tQ21\tQ22\tQ23\tQ24\tQ25\tQ26\tQ27\tQ28\tQ29\tQ30\tQ31\tQ32\tQ33\tQ34\tQ35\tQ36\tQ37\tQ38\tQ39\tQ40\tQ41\tQ42\tQ43\tQ44\tQ45\tQ46\tQ47\tQ48\tQ49\tQ50\n1\t1\t1\t1\t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\t1\t0\t1\t1\t1\t0\t0\t1\n1\t1\t1\t1\t1\t1\t1\t1\t1\t1\t1\t1\t1\t1\t1\t1\t1\t1\t1\t0\t1\t1\t1\t1\t1\t1\t0\t1\t0\t0\t1\t0\t1\t1\t1\t1\t1\t0\t1\t0\t1\t0\t1\t0\t0\t1\t1\t0\t1\t1\n1\t1\t1\t1\t1\t0\t0\t0\t1\t1\t1\t1\t1\t1\t0\t1\t1\t1\t0\t1\t0\t0\t1\t1\t0\t1\t0\t0\t0\t0\t0\t0\t0\t0\t1\t1\t1\t1\t1\t0\t0\t1\t0\t0\t0\t1\t0\t0\t0\t0\n0\t1\t1\t1\t1\t1\t1\t1\t1\t1\t0\t1\t1\t1\t0\t0\t1\t1\t1\t0\t1\t1\t1\t0\t1\t1\t1\t1\t0\t0\t1\t0\t0\t0\t1\t1\t1\t1\t0\t0\t1\t0\t1\t0\t0\t1\t1\t0\t0\t1",
mode="r", theme="cobalt", height="400px"),
br(),
p('If you need to create 1-0 data first, use',
a('Binary (1-0) Data Converter', href='https://langtest.shinyapps.io/biconv/', target="_blank"), '.'),
br(),
h3("Basic statistics (Using the raw score)"),
verbatimTextOutput("textarea.out"),
br(),
h3("Histogram of the total score (Using the raw score)"),
plotOutput("distPlot"),
br(),
h3("Boxplot (Using the raw score)"),
plotOutput("boxPlot"),
br(),
h3("Cronbach's coefficient alpha (Using the raw score)"),
verbatimTextOutput("alpha.result.out"),
p('Drop if: Cronbach alpha when the item is removed', br(),
'r dropped: item-total correlation without the item', br(),
'r: item-total (point-biserial) correlation', br(),
'IF: item facility or item mean (proportion correct answers)', br(),
'ID: item discrimination (upper 1/3 - lower 1/3)', br()
),
br(),
h3("Item estimate"),
verbatimTextOutput("item.est.out"),
br(),
h3("Person estimate (Theta)"),
verbatimTextOutput("person.est.out"),
br(),
br(),
h3("Plots"),
plotOutput("ICC"),
plotOutput("IIC"),
plotOutput("TIC"),
br(),
br(),
strong('R session info'),
verbatimTextOutput("info1.out")
),
tabPanel("Polytomous Models",
br(),
p('Note: Input values (either numeric or character) must be separated by tabs. Copy and paste from Excel/Numbers.'),
p(HTML("<b><div style='background-color:#FADDF2;border:1px solid black;'>Please make sure that your data includes the header (variable names) in the first row.</div></b>")),
aceEditor("text2", value="i01\ti02\ti03\ti04\n2\t1\t3\t3\n2\t1\t3\t1\n2\t1\t2\t1\n5\t5\t5\t5\n4\t1\t4\t2\n3\t3\t3\t4\n3\t2\t4\t1\n4\t3\t4\t3\n4\t2\t4\t3\n3\t2\t3\t2\n3\t3\t4\t3\n3\t1\t4\t3\n3\t4\t4\t5\n4\t3\t3\t3\n3\t2\t3\t3\n2\t2\t3\t3\n3\t3\t5\t3\n3\t3\t4\t2\n1\t1\t1\t1\n1\t1\t5\t2\n3\t3\t4\t4\n3\t1\t4\t1\n6\t6\t6\t6\n3\t1\t4\t3\n2\t2\t4\t2\n3\t3\t3\t2\n4\t3\t4\t3\n3\t3\t5\t5\n1\t1\t3\t1\n1\t1\t1\t1\n3\t3\t3\t3\n4\t3\t3\t3\n2\t1\t4\t3\n2\t2\t4\t3\n4\t5\t6\t4\n4\t2\t4\t3\n3\t3\t3\t3\n4\t3\t4\t3\n1\t1\t1\t1\n2\t3\t2\t3\n4\t3\t5\t3\n2\t2\t2\t2\n3\t3\t4\t3\n4\t4\t4\t4\n5\t3\t5\t5\n4\t3\t4\t6\n2\t2\t4\t6\n5\t3\t5\t5\n4\t4\t5\t4\n2\t1\t3\t1\n1\t3\t4\t4\n5\t3\t5\t3\n2\t2\t4\t1\n5\t4\t3\t3\n3\t2\t4\t4\n1\t1\t2\t3\n3\t1\t2\t3\n2\t3\t5\t5\n3\t3\t4\t4\n5\t3\t4\t4\n2\t2\t5\t3\n2\t1\t3\t3\n2\t2\t4\t4\n4\t3\t3\t4\n1\t2\t2\t2\n4\t2\t4\t4\n3\t3\t3\t2\n2\t1\t2\t1\n5\t2\t5\t3\n3\t3\t3\t4\n5\t2\t4\t5\n2\t1\t1\t1\n3\t2\t5\t3\n4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t3\t3\n4\t3\t5\t4\n1\t1\t3\t1\n2\t2\t4\t3\n3\t3\t5\t4\n3\t3\t4\t2\n2\t1\t2\t2\n3\t2\t4\t2\n1\t1\t4\t1\n4\t4\t4\t4\n4\t3\t3\t2\n2\t2\t4\t2\n3\t3\t4\t3\n4\t3\t5\t3\n5\t3\t4\t4\n3\t3\t5\t4\n3\t3\t4\t3\n2\t4\t4\t3\n3\t2\t4\t3\n4\t4\t4\t4\n3\t2\t5\t3\n3\t1\t3\t4\n4\t3\t4\t4\n3\t2\t4\t3\n4\t3\t4\t4\n2\t2\t3\t4\n2\t1\t3\t3\n3\t3\t5\t4\n3\t2\t4\t4\n5\t4\t5\t4\n4\t2\t5\t4\n4\t2\t4\t2\n2\t2\t5\t4\n3\t3\t4\t1\n2\t2\t5\t3",
mode="r", theme="cobalt", height="400px"),
br(),
br(),
h3("Basic statistics (Using the raw score)"),
verbatimTextOutput("bs.poly.out"),
br(),
h3("Histogram"),
radioButtons("meantotal1", "",
list("Average" = "mean1",
"Total" = "total1"), selected = "mean1"),
plotOutput("distPlot2"),
br(),
h3("Box plot with individual data points"),
radioButtons("meantotal2", "",
list("Average" = "mean2",
"Total" = "total2"), selected = "mean2"),
plotOutput("boxPlot2"),
br(),
h3("Cronbach's coefficient alpha (Using the raw score)"),
verbatimTextOutput("alpha.result2.out"),
p('Drop if: Cronbach alpha when the item is removed', br(),
'r dropped: item-total correlation without the item', br(),
'r: item-total (point-biserial) correlation', br()
),
br(),
plotOutput("screePlot"),
br(),
br(),
h3("Item estimate"),
radioButtons("model", strong("Model selection:"),
list("Generalized Parial Credit Model" = "gpcm.mdl",
"Graded Response Model" = "gr.mdl"
), selected = "gpcm.mdl"
),
verbatimTextOutput("polyitem.est.out"),
br(),
h3("Person estimate"),
radioButtons("person", p("Select:"),
list("No estimation of theta (person's ability)" = "no.theta",
"Show estimation of theta" = "show.theta"
),
),
verbatimTextOutput("polyperson.est.out"),
br(),
br(),
h3("Plots"),
numericInput("plot.item", "Indicate which item to plot:", 1),
plotOutput("polyICC"),
br(),
plotOutput("polyIIC"),
br(),
plotOutput("polyTIC"),
br(),
br(),
strong('R session info'),
verbatimTextOutput("info2.out")
),
tabPanel("About",
strong('Note'),
p('This web application is developed with',
a("Shiny.", href="http://www.rstudio.com/shiny/", target="_blank"),
''),
br(),
strong('List of Packages Used'), br(),
code('library(shiny)'),br(),
code('library(shinyAce)'),br(),
code('library(psych)'),br(),
code('library(CTT)'),br(),
code('library(ltm)'),br(),
code('library(beeswarm)'),br(),
code('library(parallel)'),br(),
br(),
br(),
strong('Code'),
p('Source code for this application is based on',
a('"The handbook of Research in Foreign Language Learning and Teaching" (Takeuchi & Mizumoto, 2012).', href='http://mizumot.com/handbook/', target="_blank"),'I also referred to the code used in', a("MacR.", href="https://sites.google.com/site/casualmacr/", target="_blank")),
p('The code for this web application is available at',
a('GitHub.', href='https://github.com/mizumot/irt', target="_blank")),
p('If you want to run this code on your computer (in a local R session), run the code below:',br(),
code('library(shiny)'),br(),
code('runGitHub("irt","mizumot")')
),
br(),
strong('Citation in Publications'),
p('Mizumoto, A. (2015). Langtest (Version 1.0) [Web application]. Retrieved from http://langtest.jp'),
br(),
strong('Article'),
p('Mizumoto, A., & Plonsky, L. (2015).', a("R as a lingua franca: Advantages of using R for quantitative research in applied linguistics.", href='http://applij.oxfordjournals.org/content/early/2015/06/24/applin.amv025.abstract', target="_blank"), em('Applied Linguistics,'), 'Advance online publication. doi:10.1093/applin/amv025'),
br(),
strong('Recommended'),
p('To learn more about R, I suggest this excellent and free e-book (pdf),',
a("A Guide to Doing Statistics in Second Language Research Using R,", href="http://cw.routledge.com/textbooks/9780805861853/guide-to-R.asp", target="_blank"),
'written by Dr. Jenifer Larson-Hall.'),
p('Also, if you are a cool Mac user and want to use R with GUI,',
a("MacR", href="https://sites.google.com/site/casualmacr/", target="_blank"),
'is defenitely the way to go!'),
br(),
strong('Author'),
p(a("Atsushi MIZUMOTO,", href="http://mizumot.com", target="_blank"),' Ph.D.',br(),
'Professor of Applied Linguistics',br(),
'Faculty of Foreign Language Studies /',br(),
'Graduate School of Foreign Language Education and Research,',br(),
'Kansai University, Osaka, Japan'),
br(),
a(img(src="http://i.creativecommons.org/p/mark/1.0/80x15.png"), target="_blank", href="http://creativecommons.org/publicdomain/mark/1.0/"),
p(br())
)
))
))