Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyRaborn committed Jun 24, 2022
2 parents d6aa70b + d7e130a commit a7110f2
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 89 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: caMST
Type: Package
Title: Mixed Computerized Adaptive Multistage Testing
Version: 0.1.5
Date: 2021-08-17
Version: 0.1.6
Date: 2022-06-24
Authors@R: person("Anthony", "Raborn", email = "anthony.w.raborn@gmail.com", role = c("aut","cre"))
Description: Provides functions to more easily analyze computerized adaptive tests. Currently, functions for computerized
adaptive tests (CAT), computer adaptive multistage tests (CMT), and mixed computer adaptive multistage tests (McaMST)
Expand All @@ -21,4 +21,4 @@ Imports: catR,
Suggests: testthat,
knitr,
rmarkdown
RoxygenNote: 7.1.1
RoxygenNote: 7.2.0
32 changes: 16 additions & 16 deletions R/multistage_test_function.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#' \item{final.theta.estimate}{A numeric vector of the final theta estimates using the \code{method} provided in \code{function.call}.}
#' \item{eap.theta}{A numeric vector of the final theta estimates using the expected a posteriori (EAP) theta estimate from \code{catR::eapEst}.}
#' \item{final.theta.Baker}{A numeric vector of the final theta estimates using an iterative maximum likelihood estimation procedure as described in chapter 5 of Baker (2001).}
#' \item{final.theta.SEM}{A numeric vector of the final standard error of measurement (SEM) estimates using the \code{mstR::semTheta} function.}
#' \item{final.theta.SEM}{A numeric vector of the final standard error of measurement (SEM) estimates using the \code{catR::semTheta} function.}
#' \item{final.items.seen}{A matrix of the final items seen by each individual using the supplied item names. `NA` values indicate that an individual wasn't given any items to answer after the last specified item in their row.}
#' \item{final.responses}{A matrix of the responses to the items seen in \code{final.items.seen}. \code{NA} values indicate that the individual didn't answer the question in the supplied response file or wasn't given any more items to answer.}
#' \item{transition.matrix}{The \code{transition_matrix} originally supplied to the function.}
Expand Down Expand Up @@ -138,7 +138,7 @@ multistage_test <-
seen.items = c(seen.items, which(next.module==1))
current.responses = mst.responses[, seen.items]
num.correct = sum(current.responses)
current.theta = mstR::thetaEst(it = mst_item_bank[seen.items, ],
current.theta = catR::thetaEst(it = mst_item_bank[seen.items, ],
x = as.numeric(current.responses),
method = method)
seen.modules = c(seen.modules, selected.module)
Expand All @@ -147,11 +147,11 @@ multistage_test <-
final.responses[i, ] = as.numeric(mst.responses[, seen.items])
final.items.seen[i, ] = seen.items
final.modules.seen[i,] = seen.modules
final.theta[i] = mstR::thetaEst(it = mst_item_bank[seen.items, ],
final.theta[i] = catR::thetaEst(it = mst_item_bank[seen.items, ],
x = final.responses[i, ],
method = method)

final.theta.eap[i] = mstR::eapEst(it = mst_item_bank[seen.items, ], x = final.responses[i, ])
final.theta.eap[i] = catR::eapEst(it = mst_item_bank[seen.items, ], x = final.responses[i, ])

temp.iter = iterative.theta.estimate(
initial_theta = initial_theta,
Expand All @@ -161,7 +161,7 @@ multistage_test <-
)))
final.theta.Baker[i] = temp.iter[1]
final.theta.SEM[i] =
mstR::semTheta(thEst = final.theta[i], it = mst_item_bank[seen.items, ],
catR::semTheta(thEst = final.theta[i], it = mst_item_bank[seen.items, ],
x = final.responses[i, ], model = model,
method = method)

Expand Down Expand Up @@ -196,7 +196,7 @@ multistage_test <-
seen.items = c(seen.items, which(next.module==1))
current.responses = mst.responses[, seen.items]
num.correct = sum(current.responses[length(current.responses):(sum(next.module)+1)])
current.theta = mstR::thetaEst(it = mst_item_bank[seen.items, ],
current.theta = catR::thetaEst(it = mst_item_bank[seen.items, ],
x = as.numeric(current.responses),
method = method)
seen.modules = c(seen.modules, selected.module)
Expand All @@ -205,11 +205,11 @@ multistage_test <-
final.responses[i, ] = as.numeric(mst.responses[, seen.items])
final.items.seen[i, ] = seen.items
final.modules.seen[i,] = seen.modules
final.theta[i] = mstR::thetaEst(it = mst_item_bank[seen.items, ],
final.theta[i] = catR::thetaEst(it = mst_item_bank[seen.items, ],
x = final.responses[i, ],
method = method)

final.theta.eap[i] = mstR::eapEst(it = mst_item_bank[seen.items, ], x = final.responses[i, ])
final.theta.eap[i] = catR::eapEst(it = mst_item_bank[seen.items, ], x = final.responses[i, ])

temp.iter = iterative.theta.estimate(
initial_theta = initial_theta,
Expand All @@ -219,7 +219,7 @@ multistage_test <-
)))
final.theta.Baker[i] = temp.iter[1]
final.theta.SEM[i] =
mstR::semTheta(thEst = final.theta[i], it = mst_item_bank[seen.items, ],
catR::semTheta(thEst = final.theta[i], it = mst_item_bank[seen.items, ],
x = final.responses[i, ], model = model,
method = method)
# end loop for this person; repeat loop for next
Expand All @@ -234,10 +234,10 @@ multistage_test <-
model = model,
theta = initial_theta
)
current.responses = mst.responses[, first.module$items]
current.responses = mst.responses[i, first.module$items]
seen.modules = first.module$module
seen.items = first.module$items
first.theta.est = mstR::thetaEst(it = mst_item_bank[seen.items, ],
first.theta.est = catR::thetaEst(it = mst_item_bank[seen.items, ],
x = current.responses,
method = method)

Expand All @@ -255,8 +255,8 @@ multistage_test <-
criterion = module_select
)
seen.items = c(seen.items, next.module$items)
current.responses = response_matrix[, seen.items]
current.theta = mstR::thetaEst(it = mst_item_bank[seen.items, ],
current.responses = response_matrix[i, seen.items]
current.theta = catR::thetaEst(it = mst_item_bank[seen.items, ],
x = current.responses,
method = method)
seen.modules = c(seen.modules, next.module$module)
Expand All @@ -266,11 +266,11 @@ multistage_test <-
final.responses[i, ] = as.numeric(mst.responses[, seen.items])
final.items.seen[i, ] = seen.items
final.modules.seen[i, ] = seen.modules
final.theta[i] = mstR::thetaEst(it = mst_item_bank[seen.items, ],
final.theta[i] = catR::thetaEst(it = mst_item_bank[seen.items, ],
x = final.responses[i, ],
method = method)

final.theta.eap[i] = mstR::eapEst(it = mst_item_bank[seen.items, ], x = final.responses[i, ])
final.theta.eap[i] = catR::eapEst(it = mst_item_bank[seen.items, ], x = final.responses[i, ])

temp.iter = iterative.theta.estimate(
initial_theta = initial_theta,
Expand All @@ -280,7 +280,7 @@ multistage_test <-
)))
final.theta.Baker[i] = temp.iter[1]
final.theta.SEM[i] =
mstR::semTheta(thEst = final.theta[i], it = mst_item_bank[seen.items, ],
catR::semTheta(thEst = final.theta[i], it = mst_item_bank[seen.items, ],
x = final.responses[i, ], model = model,
method = method)
# end loop for this person; repeat loop for next
Expand Down
6 changes: 3 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ data.frame("True Theta" = example_thetas,
1.96*resultsMLWMI@final.theta.SEM)
```

The theta estimates under CMT using the default module selection are close except for person 4, whose estimate falls outside of the 95% confidence interval. Using the "MLWMI" module selection does not work very well at all for this data, though.
The theta estimates under CMT using the default module selection are close as all the estimates fall within the 95% confidence interval. Using the "MLWMI" module selection produces different, but similarly accurate estimates.

### Mixed Computerized Adaptive Multistage Testing (Mca-MST)

Expand Down Expand Up @@ -205,9 +205,9 @@ catResults
data.frame("True Theta" = example_thetas,
"Estimated Theta" = catResults@final.theta.estimate,
"CI95 Lower Bound" = catResults@final.theta.estimate -
1.96*results@final.theta.SEM,
1.96*catResults@final.theta.SEM,
"CI95 Upper Bound" = catResults@final.theta.estimate +
1.96*results@final.theta.SEM)
1.96*catResults@final.theta.SEM)
```

Expand Down
Loading

0 comments on commit a7110f2

Please sign in to comment.