Statalist


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

Re: st: How to add a new variable with a specified correlation structure


From   Steven Samuels <sjhsamuels@earthlink.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to add a new variable with a specified correlation structure
Date   Tue, 8 Jul 2008 12:49:55 -0400

Draw the second variable (y_i) separately for each value of the first variable x_i (i= 1..n)

y_i ~ Normal ( mean = mu_2 + ( rho * sigma_2 * (x_i - mu_1)/sigma_1),
variance = sigma_2^2)(1 - rho^2)

-Steve

Note, however, that the sample mean and variance of the y's and the sample correlation of the x's and y's will not be equal to m_2, sigma_2, and rho, respectively

-Steve

On Jul 8, 2008, at 11:44 AM, tiago.pereira@incor.usp.br wrote:


Dear Statalisters,

After checking in detail a number of sourcers (help files, manuals,
-corre2data- and -drawnorm-, among others) I could not find a solution to
my current problem.

I have an existent variable with n observations ~N(mu_1,sigma_1^2). Note
that I have all observations. In this respect, the objective is to
generate a second (artificial) variable also ~N(mu_2, sigma_2^2), but with
a specific correlation structure with the existent, non-artificial
variable.

The main difference from the procedures obtained with both - corre2data-
and -drawnorm- is that I have already an existing variable and want to
generate a second one based on the former.

Is that task either too easy (that I cannot see how do accomplish it) or
to complicated to perform using Stata?

Thank you for your time.

All the best,

Tiago









*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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