Statalist


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

Re: st: corr2data


From   Martin Weiss <[email protected]>
To   [email protected]
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.

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

*let`s take a look
su,d

*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
su,d
*********

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.

HTH
Martin


Quoting Hema Mistry <[email protected]>:


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.

Thanks

Hema

_________________________________________________________________
Make a mini you and download it into Windows Live Messenger
http://clk.atdmt.com/UKM/go/111354029/direct/01/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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