BookmarkSubscribeRSS Feed
PGStats
Opal | Level 21

One more detail. The chi-square distribution with ν degrees of freedom has mean = ν and variance = 2ν. Do you want your treatment and control groups to be simulated with different DFs, in which case they will have different means AND different variances? 

PG
sirerwin
Calcite | Level 5

I want a chi-square distribution with 1 df (to reflect a severe nonnormality) and a heteroscedastic variance ratio of 8:1 between the treatment and control. I also want to have equal dfs for both treatment and control (balanced design). Hope this makes sense.

Thanks a lot, PG!!!

PGStats
Opal | Level 21

Do you mean that control and treatment samples should have the same mean but 1:8 variances? I think you need a related but slightly more general distribution to do that: the Gamma. Gamma(alpha, beta) has mean=alpha*beta and variance=alpha*beta**2.

As an introduction, here is how to generate an illustration of Gamma(1,1) and Gamma(0.125,8) (same mean, 1:8 variances)


data gamma;

do x = 0.1 to 10 by 0.1;
     y1 = PDF("GAMMA", x, 1, 1);
     y2 = PDF("GAMMA", x, 0.125, 8);
     output;
     end;
run;

proc sgplot data=gamma;
series x=x y=y1;
series x=x y=y2;
run;

Here is how to simulate data groups from those distributions and look at the resulting sample distributions:

data test;
call streaminit(875665);
do clustNb = 20, 40;
     do clustNo = 1 to clustNb;
          do sampSize= 10, 20;
               group="Treatment";

               do i = 1 to int(sampSize/2);
                    x = 8 * RAND("GAMMA", 0.125);
                    output;
                    end;
               group="Control";
               do i = int(sampSize/2)+1 to sampSize;
                    x = 1 * RAND("GAMMA", 1);
                    output;
                    end;
               end;
          end;
     end;
run;

proc univariate data=test;
class group;
var x;
histogram;
run;

PG

PG

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 17 replies
  • 1893 views
  • 3 likes
  • 7 in conversation