Statalist The Stata Listserver


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

st: Computing mean


From   [email protected]
To   <[email protected]>
Subject   st: Computing mean
Date   Mon, 11 Jun 2007 22:28:48 +0100

Dear Statalisters,
I am using the mdraws command and the following code to solve some integrals
using monte carlo integration:

mdraws, dr(10) neq(1) prefix(h)
forvalues v=1/10 {
replace h1_`v'=(0.5)^0.5*h1_`v'
}
forvalues v=1/10 {
gen M`v'=2*(neworgmb-1)*(xb+h1_`v')
}
forvalues v=1/10 {
gen L`v'=norm(M`v')
}
forvalues v=1/10 {
replace L`v'=ln(norm(M`v'))
}

Here I end up with L1+...+ L10 and I want to compute the average
(L1+...+L10)/10. In reality I have 1000 draws so it would be quite tedious
if I had to write the whole expression down etc. I have panel data that are
sorted by personal identification number and time. Any ideas how to proceed?






*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index