Re: [R] about IRT simulation

2010-03-11 Thread JLucke
4) a b <- rnorm(J, 0, 1) b theta <- rnorm(I, 0,1) theta for( i in 1:I ) { for( j in 1:J ) { response[i,j]<-ifelse(pij(a=a[j], b=b[j], theta[i]) < runif(1) , 0 ,1) } } response Helena Sent by: r-help-boun...@r-project.org 03/10/2010 11:03 PM To r-h...@stat.math.ethz.ch cc

Re: [R] about IRT simulation

2010-03-10 Thread Dimitris Rizopoulos
have a look at function rmvlogis() from package ltm, e.g., library(ltm) p <- 5 n <- 10 a <- rnorm(p, 0.8, 0.04) b <- rnorm(p, 0, 1) ?rmvlogis rmvlogis(n, cbind(b, a)) I hope it helps. Best, Dimitris On 3/11/2010 5:03 AM, Helena wrote: hello R: we have a two-parameter IRT simulation code.

[R] about IRT simulation

2010-03-10 Thread Helena
hello R: we have a two-parameter IRT simulation code. The goal is to generate a response matrix.But the "for" part doesn't run. we don't know what is wrong with it. Thanks so much~~~ 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