BookmarkSubscribeRSS Feed
collbb1
Calcite | Level 5

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.

 

  1. Simulation1

 

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

 

 

 

  1. 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

3 REPLIES 3
Patrick
Opal | Level 21

@collbb1

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

collbb1
Calcite | Level 5

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

Rick_SAS
SAS Super FREQ

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1426 views
  • 0 likes
  • 3 in conversation