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?
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!!!
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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.