Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Input data from keyboard combined with Monte Carlo


From   John Antonakis <John.Antonakis@unil.ch>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Input data from keyboard combined with Monte Carlo
Date   Wed, 19 Jun 2013 18:42:41 +0200

Hi Nick:

Thanks for your suggestions.

The n=11 was just indicative....I did not want to have a wieldy example.

Best,
J.

__________________________________________

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
__________________________________________

On 19.06.2013 12:36, Nick Cox wrote:
You perhaps don't want to hear the advice not to do that, but
-display- has a _request() directive that is one way to do it.

Even if you're the only user, either you'll crash this repeatedly with
silly little errors or you'll spend time writing code to catch such
errors. Perhaps you don't mind.

With 11 as the sample size, I'd consider typing them as a Stata matrix
(vector) or as a numlist in an option. The two can be combined.

Nick
njcoxstata@gmail.com


On 19 June 2013 11:20, John Antonakis <John.Antonakis@unil.ch> wrote:
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/
*
*   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/

*
*   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/


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