在做IRT模拟的时候,循环不知道为什么不运行
I <- 10
J <- 5
response <- matrix(0, 10, 5)
pij <- function(a,b,theta)
{
a <- rnorm(J, 0.8, 0.04)
a
b <- rnorm(J, 0, 1)
b
theta <- rnorm(I, 0,1)
theta
for( i in 1:I ) {
 for( j in 1:J ) {
ptemp <- runif(1)
  pij <- exp(a[j]*(theta[i]-b[j]))/(1+exp(a[j]*(theta[i]-b[j])))
 response[i,j]<-ifelse(pij(b=b[j], a=a[j], theta[i]) < ptemp , 0 ,1)
}
}
}
response 
急请达人帮助~~~~
谢谢~~~~