Beruflich Dokumente
Kultur Dokumente
Jordan Elm
7/26/2007
Reference:
SAS for Monte Carlo Studies: A Guide for Quantitative Researchers
by Xitao Fan, Akos Felsovalyi, Stephen Sivo, and Sean Keenan
Copyright(c) 2002 by SAS Institute Inc., Cary, NC, USA
What is meant by
Running Simulations
Suitable Questions
2.
3.
4.
5.
Generating Data
is an integer.
If seed < 0, the time of day is used to initialize
the seed stream, and the stream of random
numbers is not replicable.
If you use a positive seed, you can always
replicate the stream of random numbers by
using the same DATA step, but must make your
macro program change seed for each
replication of the do loop.
Generating Data
Multivariate data:
%MVN
macro
Download from
http://support.sas.com/ctx/samples/index.jsp?sid=509
Example
Generating Non-Normal data
**** Program 4.3 Fleishman Method for Generating 3 Non-Normal Variables ****;
DATA A;
DO I = 1 TO 10000;
X1 = RANNOR (0);
X2 = RANNOR (0);
X3 = RANNOR (0);
*** Fleishman non-normality transformation;
X1 = -.124833577 + .978350485*X1 + .124833577*X1**2 + .001976943*X1**3;
X2 = .124833577 + .978350485*X2 - .124833577*X2**2 + .001976943*X2**3;
X3 = -.096435287 + .843688891*X3 + .096435287*X3**2 + .046773413*X3**3;
X1 = 100 + 15*X1;
***linear transformation;
X2 = 50 + 10*X2;
X3 = X3;
OUTPUT;
END;
PROC MEANS N MEAN STD SKEWNESS KURTOSIS;
VAR X1 X2 X3;
PROC CORR NOSIMPLE;
VAR X1 X2 X3;
RUN;
**************************************************************************;
Example of MC study
Proc IML
Program 6.3:
Assessing the effect of Data NonNormality on the Type I error rate in
ANOVA
Examples of Simulation
Studies in Epidemiology
Simulation Study of
Confounder-Selection Strategies
G Maldonado, S Greenland
American Journal of Epidemiology Vol. 138, No. 11: 923-936
Problem
Do 1000 replications
Let the sample size for the 2 groups
(X1 and X2) be 20/group.
Alpha=0.05
Mean=50 (under null) Mean=40
(under alternative)
SD=10 and 15
Compute a 2-sample t-test
Reference