Hello,
My 2PL model data generation is as below
twopl.sim <- function( nitem = 200, npers = 2688 ) {
i.loc <- item_b1
p.loc <- rnorm( npers )
i.slp <- item_a1
temp <- matrix( rep( p.loc, length( i.loc ) ), ncol = length( i.loc ) )
logits <- t( apply( temp , 1, '-', i.loc) )
logits <- t( apply( logits, 1, '*', i.slp) )
probabilities <- 1 / ( 1 + exp( -logits ) )
resp.prob <- matrix( probabilities, ncol = nitem)
obs.resp <- matrix( sapply( c(resp.prob), rbinom, n = 1, size = 1), ncol = length(i.loc) )
output <- list()
output$i.loc <- i.loc
output$i.slp <- i.slp
output$p.loc <- p.loc
output$resp <- obs.resp
output
}
In the code above, i.loc is b parameter, i.slp is a parameter, i want the following information to be incorporated in the code above
Thank you for any help!