if (FALSE) {
# Numerical example for post hoc power analysis for Rasch Model
y <- eRm::raschdat1
n <- nrow(y) # sample size
x <- c( rep(0,n/2), rep(1,n/2) ) # binary covariate
res <- post_hocRM(data = y, splitcr = x, alpha = 0.05)
# > res
# $test
# W LR RS GR
# 29.241 29.981 29.937 30.238
#
# $power
# W LR RS GR
# 0.890 0.900 0.899 0.903
#
# $dev_global #`observed global deviation`
# W LR RS GR
# 0.292 0.300 0.299 0.302
#
# $dev_local #`observed local deviation`
# I2 I3 I4 I5 I6 I7 I8 I9 I10 I11
# group1 1.039 0.693 2.790 2.404 1.129 1.039 0.864 1.039 2.790 2.244
# group2 2.006 0.945 2.006 3.157 1.834 0.690 0.822 1.061 2.689 2.260
# I12 I13 I14 I15 I16 I17 I18 I19 I20 I21
# group1 1.412 3.777 3.038 1.315 2.244 1.039 1.221 2.404 0.608 0.608
# group2 0.945 2.962 4.009 1.171 2.175 1.472 2.091 2.344 1.275 0.690
# I22 I23 I24 I25 I26 I27 I28 I29 I30
# group1 0.438 0.608 1.617 3.038 0.438 1.617 2.100 2.583 0.864
# group2 0.822 1.275 1.565 2.175 0.207 1.746 1.746 2.260 0.822
#
# $score_dist_group1 #`person score distribution in group 1`
#
# 1 2 3 4 5 6 7 8 9 10 11 12 13
# 0.02 0.02 0.02 0.06 0.02 0.10 0.10 0.06 0.10 0.12 0.08 0.12 0.12
# 14 15 16 17 18 19 20 21 22 23 24 25 26
# 0.06 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
# 27 28 29
# 0.00 0.00 0.00
#
# $score_dist_group2 #`person score distribution in group 2`
#
# 1 2 3 4 5 6 7 8 9 10 11 12 13
# 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
# 14 15 16 17 18 19 20 21 22 23 24 25 26
# 0.08 0.12 0.10 0.16 0.06 0.04 0.10 0.12 0.08 0.02 0.02 0.02 0.08
# 27 28 29
# 0.00 0.00 0.00
#
# $df #`degrees of freedom`
# [1] 29
#
# $ncp #`noncentrality parameter`
# W LR RS GR
# 29.241 29.981 29.937 30.238
#
# $call
# post_hocRM(alpha = 0.05, data = y, x = x)
}
Run the code above in your browser using DataLab