Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Input data from keyboard combined with Monte Carlo
From
John Antonakis <[email protected]>
To
[email protected]
Subject
st: Input data from keyboard combined with Monte Carlo
Date
Wed, 19 Jun 2013 12:20:44 +0200
Suppose that I want to run the below program.
clear
capture program drop sim
version 12
program define sim, rclass
drop _all
set obs 11
foreach var of newlist x1-x5 {
gen `var' = rnormal()
}
reg y x*
end
simulate explvar=e(r2), reps(50) seed(123): sim
Now I want to generate y by using fixed-values that I input, e.g.,
input y
4.715581
4.296504
4.170745
2.065717
3.648136
8.156727
2.280866
2.817171
2.647611
3.272532
end
How can I combine inputting the data within the MC program so that the
y-values are always fixed and that the x's are randomly generated?
Best,
John.
__________________________________________
John Antonakis
Professor of Organizational Behavior
Director, Ph.D. Program in Management
Faculty of Business and Economics
University of Lausanne
Internef #618
CH-1015 Lausanne-Dorigny
Switzerland
Tel ++41 (0)21 692-3438
Fax ++41 (0)21 692-3305
http://www.hec.unil.ch/people/jantonakis
Associate Editor
The Leadership Quarterly
__________________________________________
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/