Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: selecting random samples and run a simulation


From   "Maarten Buis" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: selecting random samples and run a simulation
Date   Fri, 13 Jul 2007 16:59:14 +0200

As both the controls and the cases are random draws from a normal distribution and the two are uncorrelated you can just draw 1000 random numbers from a normal distribution and call the first 500 controls and the last 500 cases. 

set obs 1000
gen control_case = invnorm(uniform())
gen status = _n >500

Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Natarajan, Raj
Sent: vrijdag 13 juli 2007 16:47
To: [email protected]
Subject: st: RE: selecting random samples and run a simulation

I sent this e-mail yesterday but did not get any response. So I am resending hoiping it will come out.

________________________________

From: Natarajan, Raj
Sent: Thu 7/12/2007 8:26 AM
To: [email protected]
Subject: selecting random samples and run a simulation



I would like to draw a random sample of 500 controls and 500 cases and calculate the odds ratio; repeat the process for 1000 times.

Example: (draw random sample)

matrix means=(0, 1.4)

matrix stdev = (1, 1)

draw norm control case, n(500) m (means) sds(stdev)


the outcome for the first 5 observations  will look like this:

  control          case

 -1.315189      .1754738

-.6195259       -.4363556

-1.18018        .2124426

-.2960889       -.5825416

.4534519        -.1245893

PROBLEM: I would like the outcomes for controls and cases to be in one column and create a new variable called "status" which is 0 for control and 1 for case.

Control_case        status

-1.315189               0

-.6195259               0

-1.18018                0

-.2960889               0

.4534519                0

.1754738                1

-.4363556               1

.2124426                1

-.5825416               1

-.1245893               1

I have to run the logistic regression to calculate the odds ratios; and repeat the process with different variances.

I would like to know how to make the outcomes arranged in one column with the creation of the variables "control_case" and "status".

Thank you for any suggestion.

Raj



This email message may contain legally privileged and/or confidential information.  If you are not the intended recipient(s), or the employee or agent responsible for the delivery of this message to the intended recipient(s), you are hereby notified that any disclosure, copying, distribution, or use of this email message is prohibited.  If you have received this message in error, please notify the sender immediately by e-mail and delete this email message from your computer. Thank you.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index