Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Simulation data using SAS

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-17-2018 02:25 PM

How do I code my sas prog. to solve this problem?

I trying to comparing correlated means in the presence of incomplete data (Task) using simulated data

I've tried to perform this task using simulated date - statistical power cal.

Compute the empirical size and power calculation using 1000 data sets and significance level of α = 0:05. Under the alternative hypotheses is varied among 0 and 1.0, and the correlation is varied among ρ = 0.2 and 0.9.

- Simulation1

Generate from Exponential distribution with scale parameter = 1; using np = 20, nux = 10, and nuy = 25

- Simulation 2

Generate from normal distribution using np = 20, nux = 30, and nuy = 10

- Simulation 3

Generate from normal distribution using np = 10, nux = 15, and nuy = 5

Where **np** represent the number of complete pairs where both observations (x; y) are present, nux is the number of unpaired observations where only the first value (x) is present

and nuy is the number of unpaired observations where only the second value (y) is present.

Figure 4 – Two Correlated Normally Distributed Variables

Data Example4;

call streaminit(5678);

keep x y;

mu1=10; mu2=20; var1=4; var2=9; rho=.5;

do i = 1 to 1000;

x = rand("Normal", 0,1);

y = rho*x+sqrt(1-rho**2)*rand("Normal",0,1);

x = mu1 + sqrt(var1)*x;

y = mu2 + sqrt(var2)*y;

output;

end;

run

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to collbb1

03-17-2018 10:00 PM

You will most likely have to ask a more specific question than *How do I code my sas prog.* to get an answer.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to collbb1

03-18-2018 12:03 PM

Thanks, Need to know how to set up sas code to simulate dat

Compute the empirical size and power calculation using 1000 data sets and significance level of α = 0:05. Under the alternative hypotheses is varied among 0 and 1.0, and the correlation is varied among ρ = 0.2 and 0.9.

Simulation1

Generate from Exponential distribution with scale parameter = 1; using np = 20, nux = 10, and nuy = 25

Where np represent the number of complete pairs where both observations (x; y) are present, nux is the number of unpaired observations where only the first value (x) is present

and nuy is the number of unpaired observations where only the second value (y) is present

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to collbb1

03-21-2018 03:57 PM

It sounds like you are looking for resources and sample code. Rather than answer your specific questions, here are some links that you might find useful:

Start by reading "Simulation in SAS: The slow way or the BY way" to learn the general structure of simulation code.

To learn how to simulate multivariate normal data in SAS, see "Sampling from the multivariate normal distribution" and "How to generate multiple samples from the multivariate normal distribution in SAS". If you don't have SAS/IML, you can use PROC SIMNORMAL. For 2-D data or for nonnormal data, you can use the DATA step, as you are doing in your post.

For power estimation using simulation, see "Using simulation to estimate the power of a statistical test."

For more information, see "Ten Tips for Simulating Data with SAS", which includes an example of using simulations to estimate power. For many more examples and details, see *Simulating Data with SAS*.