# st: uvis - rationale for generating random b's

 From Jake F To statalist@hsphsun2.harvard.edu Subject st: uvis - rationale for generating random b's Date Sun, 20 May 2007 13:32:35 -0700 (PDT)

```I was curious about the rationale for the following
code, which is contained within uvis, the command for
imputing data that is called repeatedly by ice.  Both
of these programs were written by Patrick Royston.

My understanding is that, for the purposes of imputing
values for missing y's, one must generate a normally
distributed random error term in the regression, and
generate random betas.  This question is about the
code for generating the random betas.

`V' is the variance/covariance matrix of the betas
from the imputation regression, which was already run
at this point.

I'm guessing that including the cholesky factorization
allows one to maintain the same relationships between
the beta coefficients as one imputes new beta
coefficients (?)  This appears analogous to the way
the cholesky factor is used to generate data that
distributed multivariate normal and correlated in a
particular way(?)

A value is drawn from the chi-square distribution and
then used to generate a random Root Mean Square Error
(RMSEstar).  I'm confused about why a RMSEstar must be
drawn here, and how the chi-square distribution
relates to this, and how it relates to the cholesky
factorization.

(See below.)

Thanks,
Jacob Felson

matrix `chol'=cholesky(`V')

* Draw beta, and if necessary rmse, for proper
imputation

if `normal' {
* draw rmse
local rmse=e(rmse)
local df=e(df_r)
local chi2= 2*invgammap(`df'/2,uniform())
local rmsestar=`rmse'*sqrt(`df'/`chi2')
matrix `chol'=`chol'*sqrt(`df'/`chi2')
}

* draw beta
forvalues i=1/`colsofb' {
matrix `e'[1,`i']=invnorm(uniform())
}
matrix `bstar'=`b'+`e'*`chol''

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
*
*   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/
```