[R] mirt-simdata question.

Suna Paek p@ek @end|ng |rom uwm@edu
Thu Jul 11 02:49:00 CEST 2019


Hi. again.

Still the same problem, but I made a new code to see better of my question.
Like the first email, I still want each item's categories to have a normal distribution. it doesn't have to statistically fit. I made 2 different code. And, I found if the histogram is the opposite, they will be normal distributions.
In detail, most items have the highest frequencies(probabilities) in the first category and the last category. The middle categories are fewer frequencies.

Is there any way to opposite the frequency, so that each item has normal category distribution?

I have to figure out this problem. Please help me!



###two dimensional 10 items 5 categorical data simulation
Theta <- rmvnorm((1000*2), sigma = sigma)

set.seed(12)
#slope matrix of 10=items, item1-5:factor1, item6-10: factor2
aa <- matrix(c(rlnorm(5,.2,.2),rep(0,10),rlnorm(5,.2,.2)),10) #rlnorm-log normal distribution
dd<-matrix(rnorm((10*5),0,.3), 10)
dd <- t(apply(dd, 1, sort, decreasing=TRUE)) #sort since intercepts are ordered
polytomous5 <- simdata(aa, dd, 1000, Theta=Theta, itemtype = 'gpcm')
summary(polytomous5)
hist(polytomous5[,1])
hist(polytomous5[,2])
hist(polytomous5[,3])
hist(polytomous5[,4])
hist(polytomous5[,5])
hist(polytomous5[,6])
hist(polytomous5[,7])
hist(polytomous5[,8])
hist(polytomous5[,9])
hist(polytomous5[,10])

Theta <- rmvnorm((1000*2), sigma =sigma)
set.seed(12)
#set a parameters
a <- matrix(c(2.5,NA,2.0,NA,1.5,NA,1.0,NA,0.5,NA,NA,0.5,NA,1.0,NA,1.5,NA,2.0,NA,2.5),ncol=2,byrow=TRUE)
d<-matrix(rnorm((10*5),0,.3), 10)
d <- t(apply(d, 1, sort, decreasing=TRUE)) #sort since intercepts are ordered
polytomous51 <- simdata(a, d, 1000, Theta=Theta, itemtype = 'gpcm')
summary(polytomous51)
hist(polytomous51[,1])
hist(polytomous51[,2])
hist(polytomous51[,3])
hist(polytomous51[,4])
hist(polytomous51[,5])
hist(polytomous51[,6])
hist(polytomous51[,7])
hist(polytomous51[,8])
hist(polytomous51[,9])
hist(polytomous51[,10])


Soonhwa(Suna) Paek
Educational Psychology-Statistics and Measurements
University of Wisconsin-Milwaukee
paek using uwm.edu 262-441-3019

________________________________
From: Suna Paek
Sent: Wednesday, July 10, 2019 5:58 PM
To: R-help using R-project.org
Subject: Re: mirt-simdata question.

Hi. I always thank you all of the R program worker and researchers.

I am using R for my thesis, and I have a question.

I am simulating multi-dimensional and categorical items (polytomous) with mirt-simdata.
However, I wish each items' categories are normal distribution. I checked a lot of information from the internet. Unfortunately, I couldn't find a good one.
It looks like before version, there is a 'simdata_normal' function, but not anymore.
Is there another way to simulate the normal distribution of the multi-dimensional item polytomous-responses?

Here is my code, I was working on.

#two dimensional categorical data simulation
Theta <- rmvnorm(10000, sigma = matrix(c(1, .5, .5, 1), 2)) #correlation of .5
summary(Theta)

set.seed(12345)
#slope matrix of 20 rows=items, a1=10 factor 1, a2=10 factor 2
aa <- matrix(c(rlnorm(20,.2,.3),rep(0,40),rlnorm(20,.2,.3)),40) #rlnorm-log normal distribution
dd<-matrix(rnorm((40*4),0,2.0), 40)
dd <- t(apply(dd, 1, sort, decreasing=TRUE)) #sort since intercepts are ordered
polytomous4 <- simdata(aa, dd, 10000, Theta=Theta, itemtype = 'gpcm')
summary(polytomous4)

Can anyone please check and help me?
I desperately have to figure out this problem as soon as possible.

Thank you very much for reading my question.
Have a good day.
God bless you!

Best,



Soonhwa(Suna) Paek
Educational Psychology-Statistics and Measurements
University of Wisconsin-Milwaukee
paek using uwm.edu 262-441-3019



Soonhwa(Suna) Paek
Educational Psychology-Statistics and Measurements
University of Wisconsin-Milwaukee
paek using uwm.edu 262-441-3019

________________________________
From: Suna Paek
Sent: Wednesday, July 10, 2019 3:46 PM
To: R-windows using R-project.org
Subject: mirt-simdata question.

Hi. I always thank you all of the R program worker and researchers.

I am using R for my thesis, and I have a question.

I am simulating multi-dimensional and categorical items (polytomous) with mirt-simdata.
However, I wish each items' categories are normal distribution. I checked a lot of information from the internet. Unfortunately, I couldn't find a good one.
It looks like before version, there is a 'simdata_normal' function, but not anymore.
Is there another way to simulate the normal distribution of the multi-dimensional item polytomous-responses?

Here is my code, I was working on.

#two dimensional categorical data simulation
Theta <- rmvnorm(10000, sigma = matrix(c(1, .5, .5, 1), 2)) #correlation of .5
summary(Theta)

set.seed(12345)
#slope matrix of 20 rows=items, a1=10 factor 1, a2=10 factor 2
aa <- matrix(c(rlnorm(20,.2,.3),rep(0,40),rlnorm(20,.2,.3)),40) #rlnorm-log normal distribution
dd<-matrix(rnorm((40*4),0,2.0), 40)
dd <- t(apply(dd, 1, sort, decreasing=TRUE)) #sort since intercepts are ordered
polytomous4 <- simdata(aa, dd, 10000, Theta=Theta, itemtype = 'gpcm')
summary(polytomous4)

Can anyone please check and help me?
I desperately have to figure out this problem as soon as possible.

Thank you very much for reading my question.
Have a good day.
God bless you!

Best,



Soonhwa(Suna) Paek
Educational Psychology-Statistics and Measurements
University of Wisconsin-Milwaukee
paek using uwm.edu 262-441-3019

	[[alternative HTML version deleted]]



More information about the R-help mailing list