digithead
Thinker
- Joined
- Feb 4, 2005
- Messages
- 147
I haven't used Matlab in years so I don't know....
In SAS, to generate a random bivariate normal from two N(0,1) random variables with a correlation of 0.5 it's:
data a;
keep x y;
mu1=0; mu2=0; sigma1=1; sigma2=1; rho=.5;
do i = 1 to 10000;
x = mu1+sqrt(sigma1)*rannor(0);
y = (mu2+rho*(sqrt(sigma2)/sqrt(sigma1))*(x-mu1)) +
sqrt(sigma2*(1-rho**2))*rannor(0);
output;
end;
run;
The rannor function with a seed of 0 generates the random number off of the computer clock at the time of calculation so it's somewhat the "most random" of the pseudorandom number generators...
One can also adapt the above to any other mu, sigma or rho they wish and I'm sure it can be translated into Matlab or any other stats/math package that's used...
But it's a moot point because as I've pointed out above, studies have shown that intercessory prayer has no clinical effectiveness. In fact, when Masters, et al (2006) removed the discredited Cha and Wirth (2001) study, the overall effect of intercessory prayer not just not statistically insignificant it was nearly nil...
So I'd just leave Saizai to his wishful thinking that he'll somehow demonstrate that prayer works...
In SAS, to generate a random bivariate normal from two N(0,1) random variables with a correlation of 0.5 it's:
data a;
keep x y;
mu1=0; mu2=0; sigma1=1; sigma2=1; rho=.5;
do i = 1 to 10000;
x = mu1+sqrt(sigma1)*rannor(0);
y = (mu2+rho*(sqrt(sigma2)/sqrt(sigma1))*(x-mu1)) +
sqrt(sigma2*(1-rho**2))*rannor(0);
output;
end;
run;
The rannor function with a seed of 0 generates the random number off of the computer clock at the time of calculation so it's somewhat the "most random" of the pseudorandom number generators...
One can also adapt the above to any other mu, sigma or rho they wish and I'm sure it can be translated into Matlab or any other stats/math package that's used...
But it's a moot point because as I've pointed out above, studies have shown that intercessory prayer has no clinical effectiveness. In fact, when Masters, et al (2006) removed the discredited Cha and Wirth (2001) study, the overall effect of intercessory prayer not just not statistically insignificant it was nearly nil...
So I'd just leave Saizai to his wishful thinking that he'll somehow demonstrate that prayer works...