Skip to content

Commit

Permalink
rm deadcode
Browse files Browse the repository at this point in the history
  • Loading branch information
philchalmers committed Apr 16, 2016
1 parent d3b06d1 commit e7494f6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 0 additions & 2 deletions R/personfit.R
Expand Up @@ -103,8 +103,6 @@ personfit <- function(x, method = 'EAP', Theta = NULL, stats.only = TRUE, ...){
J <- ncol(x@Data$data)
itemloc <- x@Model$itemloc
pars <- x@ParObjects$pars
prodlist <- attr(pars, 'prodlist')
nfact <- x@Model$nfact + length(prodlist)
fulldata <- x@Data$fulldata[[1L]]
for(i in 1L:ncol(Theta)){
tmp <- Theta[,i]
Expand Down
11 changes: 6 additions & 5 deletions R/simdata.R
Expand Up @@ -42,18 +42,18 @@
#' @param gpcm_mats a list of matricies specifying the scoring scheme for generalized partial
#' credit models (see \code{\link{mirt}} for details)
#' @param sigma a covariance matrix of the underlying distribution. Default is
#' the identity matrix
#' the identity matrix. Used when \code{Theta} is not supplied
#' @param mu a mean vector of the underlying distribution. Default is a vector
#' of zeros
#' of zeros. Used when \code{Theta} is not supplied
#' @param Theta a user specified matrix of the underlying ability parameters,
#' where \code{nrow(Theta) == N} and \code{ncol(Theta) == ncol(a)}. When this is supplied the
#' \code{N} input is not required
#' @param returnList logical; return a list containing the data, item objects defined
#' by \code{mirt} containing the population parameters and item structure, and the
#' latent trait matrix \code{Theta}? Default is FALSE
#' @param model a single group object, typically returned by functions such as \code{\link{mirt}} or
#' \code{\link{bfactor}}. Supplying this will render all other parameter elements (excluding the Theta
#' input) redundent
#' \code{\link{bfactor}}. Supplying this will render all other parameter elements (excluding the
#' \code{Theta}, \code{N}, \code{mu}, and \code{sigma} inputs) redundent
#' @param which.items an integer vector used to indicate which items to simulate when a
#' \code{model} input is included. Default simulates all items
#' @param mins an integer vector (or single value to be used for each item) indicating what
Expand Down Expand Up @@ -263,14 +263,14 @@ simdata <- function(a, d, N, itemtype, sigma = NULL, mu = NULL, guess = 0,
model = NULL, which.items = NULL, mins = 0)
{
fn <- function(p, ns) sample(1L:ns - 1L, 1L, prob = p)
if(missing(N) && is.null(Theta)) missingMsg('N or Theta')
if(!is.null(model)){
nitems <- extract.mirt(model, 'nitems')
if(is.null(which.items)) which.items <- 1L:nitems
nfact <- model@Model$nfact
if(is.null(sigma)) sigma <- diag(nfact)
if(is.null(mu)) mu <- rep(0,nfact)
if(is.null(Theta)){
if(missing(N)) N <- nrow(extract.mirt(model, 'data'))
Theta <- mirt_rmvnorm(N,mu,sigma,check=TRUE)
} else N <- nrow(Theta)
data <- matrix(0, N, nitems)
Expand All @@ -283,6 +283,7 @@ simdata <- function(a, d, N, itemtype, sigma = NULL, mu = NULL, guess = 0,
ret <- t(t(data) + model@Data$mins)
return(ret[,which.items, drop=FALSE])
}
if(missing(N) && is.null(Theta)) missingMsg('N or Theta')
if(missing(a)) missingMsg('a')
if(missing(d)) missingMsg('d')
if(missing(itemtype)) missingMsg('itemtype')
Expand Down
8 changes: 4 additions & 4 deletions man/simdata.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e7494f6

Please sign in to comment.