perturbResp function

perturbResp

perturbResp

Perturbs a response given specified (item) misfit to implied model.

perturbResp(ability, item, group, perturbation)

Arguments

  • ability: a double - the location of the person on the measure.
  • item: a matrix - the item parameters in the format required by conquestr::simplef
  • group: a string - the group this case belongs to. If NULL, the case is always in this group.
  • perturbation: A matrix - the description of the way this item should be perturbed. In the format required by conquestr::genResponses

Returns

A double - the observed response.

Examples

myN <- 250 myMean <- 0 mySd <- 2 myGroups <- c("gfit", "bfit") myAbilities <- rnorm(myN, myMean, mySd) # students with large weights and unperturbed responses (good fit) # and students with small weights and perturbed responses (bad fit) myData <- data.frame( ability = myAbilities, group = factor(sample(x = myGroups, size = myN, replace = TRUE)) ) myData$weight <- ifelse(myData$group == myGroups[1], 1, 0.001) myItems <- list() myItems[[1]] <- matrix(c( 0, 0, 0 , 1, 1, 1, -0.2, 1, 2, 1, 0.2 , 1 ), ncol = 4, byrow = TRUE) myPerturbations<- list() myPerturbations[[1]] <- list() myPerturbations[[1]] <- append(myPerturbations[[1]], 1L) myPerturbations[[1]] <- append(myPerturbations[[1]], "discrimination") myPerturbations[[1]] <- append(myPerturbations[[1]], 0.50) myPerturbations[[1]] <- append(myPerturbations[[1]], 0) myPerturbations[[1]] <- append(myPerturbations[[1]], "bfit") names(myPerturbations[[1]]) <- c("item", "type", "factor", "pivot", "group") myResponses <- genResponses( abilities = myData$ability, itemParams = myItems, perturbR = myPerturbations, groups = myData$group )

See Also

simplef(), genResponses(), browseVignettes("conquestr")

  • Maintainer: Dan Cloney
  • License: GPL-3
  • Last published: 2025-02-19