Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Monte Carlo Simulations


From   Pieter Tuytens <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Monte Carlo Simulations
Date   Sat, 27 Apr 2013 20:52:07 +0200

Dear Statalist,


I am using Stata 12 and trying to do some Monte Carlo simulations on ordered logit models. Goal is to simulate 4 groups who fill in a question (5-point Likert Scale). The size of these groups should be different; group 1 -> 120 obs/ group 2 -> 80 obs / group 3 -> 300 obs and group 4 -> 60 obs. The challenge however exists in the answering structure of each group; group 1 should be more centered around 2 while group 2 around 3, group 3 around 3.5 and group 4 around 4. Each group should thus have the same latent equation but because of ‘cultural differences’ these groups should offer different answers on the Likert type question. Goal is to examine what happens if you aggregate these different answers. I have however some difficulties in programming this, so far I have the following code:
set seed 1234
program drop _all
program define sim
drop _all

set obs 500

 gen x1 = rnormal()
 gen x2 = rnormal()
 gen u = runiform()

 gen ystar2 = 1 + x1 - .5*x2 + ln(u/(1-u))
 gen ystar3 = -1 + x1 - 1*x2 + ln(u/(1-u))
 gen ystar4 = 1 + x1 - .5*x2 + ln(u/(1-u))
 gen ystar5 = -1 + x1 - 1*x2 + ln(u/(1-u))
 gen y1 = cond(ystar2 < -0.5, 1, cond(ystar3 < 0, 2, 3))
 gen y2 = cond(ystar4 < -0.5, 1, cond(ystar5 < 0, 2, 3))
 gen y= (y1+y2)/2
ologit y x1 x2, or
end

simulate _b _se, reps(100) : sim

Until now I have only included two groups, but I wonder if what I have done is correct and how I program the groups while being able to toy around with the sizes of these groups. Any help/ advice would be welcome!

Best regards,

Pieter 		 	   		  
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index