I’m an R convert from a graduate program that taught exclusively SPSS, so I’m having to constantly fill in knowledge gaps when it comes to R packages. Apologies, therefore, for what may be a very simple question.
I’m currently using the “mirt” package from Chalmers to simulate dichotomous item response data based on previously published item parameters. I’d like to create, say, 500 simulated datasets (using the simdata and mirt functions). Based on those simulated datasets, I’d also like to generate latent trait scores from each one (using the fscores function). Is there some way that I can have those processes run all 500 times automatically (i.e., I’m really not wanting to have to run the same code 500 times by manually pressing up and enter again and again)?
Ideally, at the end of all 500 sample generations, I’d have a dataset consisting of just the latent trait scores and raw number of correctly answered items for each simulated dataset and another dataset consisting of a pooled tertachoric correlation matrix of each test item (40 item test) from the simulated data. For the latter I’m looking at “metaSEM” package from Cheung for this latter step.
I’ve tried using the rep() function only to get the same parameters entered into a data frame 500 times, so I figure that I must be doing something wrong. Any help is welcome!