[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: corr2data

From   Martin Weiss <>
Subject   Re: st: corr2data
Date   Fri, 12 Sep 2008 21:12:06 +0200

You can get rid of the negatives after -drawnorm- but there is no way the mean stays constant then.

set seed 12345
matrix C = (1, .5 \ .5, 1)
drawnorm x y, n(1000) corr(C)

*let`s take a look

*kill the negative values
su y, mean
replace y=y-r(min)
su x,mean
replace x=x-r(min)

*sd the same, mean shifted upwards

You could also plug in a mean of 10 and a sd of 1 into -drawnorm-, and there is very little chance you will get any negatives, but I suspect you have something different in mind.


Quoting Hema Mistry <>:

Dear all,

Does anyone know with the corr2data command whether you can set a lower and upper limit whilst keeping the same mean and sd?

Also is there another command similar to corr2data (drawnorm also has the same problems) which won't give me negative values and produces the same mean and SD, but keeping the original values and expanding on these values.



Make a mini you and download it into Windows Live Messenger
* For searches and help try:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index