Created difficulty matrix generation R script + initial scenarios
This commit is contained in:
39
Scripts/R/generate_item_difficulties.R
Normal file
39
Scripts/R/generate_item_difficulties.R
Normal file
@ -0,0 +1,39 @@
|
||||
###################################################
|
||||
# Function: generate_diff_irt
|
||||
# Generates item difficulty threshold matrix for
|
||||
# IRT model simulation
|
||||
###################################################
|
||||
|
||||
|
||||
generate_diff_irt <- function(J=7,M=4) {
|
||||
# if J=7, item 5. Else, item 3
|
||||
if(J==7){
|
||||
i <- 5
|
||||
}
|
||||
if(J==4){
|
||||
i <- 3
|
||||
}
|
||||
difficulties = matrix(c(0), J,M-1)
|
||||
rownames(difficulties)=paste("item",1:J)
|
||||
colnames(difficulties)=paste("Moda", 1:(M-1))
|
||||
for (j in 1:J){
|
||||
difficulties[j,1] = qnorm(j/(J+1))
|
||||
}
|
||||
for (j in 1:J){
|
||||
for (m in 2:(M-1)){
|
||||
difficulties[j,m]= difficulties[j,1]+(m-1)*2/(M-2)
|
||||
}
|
||||
}
|
||||
difficulties = difficulties-mean(difficulties)
|
||||
return(difficulties)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
###################################################
|
||||
# GENERATE MATRIX FOR SIMULATION
|
||||
###################################################
|
||||
|
||||
|
Reference in New Issue
Block a user