if (FALSE) {
# Numerical example with 200 persons and 4 items
# presented twice, thus 8 virtual items
# Data y generated under the assumption that shift parameter equals 0.5
# (change from time point 1 to 2)
# design matrix W used only for exmaple data generation
# (not used for estimating in change_test function)
W <- rbind(c(1,0,0,0,0), c(0,1,0,0,0), c(0,0,1,0,0), c(0,0,0,1,0),
c(1,0,0,0,1), c(0,1,0,0,1), c(0,0,1,0,1), c(0,0,0,1,1))
# eta parameter vector, first 4 are nuisance, i.e., item parameters at time point 1.
# (easiness parameters of the 4 items at time point 1),
# last one is the shift parameter
eta <- c(-2,-1,1,2,0.5)
y <- eRm::sim.rasch(persons=rnorm(150), items=colSums(-eta*t(W)))
res <- post_hocChange(data = y, alpha = 0.05)
# > res
# $test
# W LR RS GR
# 9.822 10.021 9.955 10.088
#
# $power
# W LR RS GR
# 0.880 0.886 0.884 0.888
#
# $dev_obs #`observed deviation (estimate of shift parameter)`
# [1] 0.504
#
# $score_dist #`person score distribution`
#
# 1 2 3 4 5 6 7
# 0.047 0.047 0.236 0.277 0.236 0.108 0.047
#
# $df #`degrees of freedom`
# [1] 1
#
# $ncp # `noncentrality parameter`
# W LR RS GR
# 9.822 10.021 9.955 10.088
#
# $call
# post_hocChange(alpha = 0.05, data = y)
}
Run the code above in your browser using DataLab