Thursday, January 05, 2006

st: RE: A dialog box to perform simulations.

Thanks Nick,

Yes, display can do that. And more generally, it is easier to do it through an ado. The user enters values in the options and the program computes results.

What I am trying to do in my first question is to build a dialog box to perform simulations. This is intended to non-stata skilled official people in Africa. The idea is just to allow them to enter values in the box and get results (for the moment, I am focusing on child mortality: so if the user changes for example the mothers education rate, what will be the gain in child mortality?). I was doing this under excel with VB, after getting my coefficients results in stata using streg ..., d(w). Then, I tought stata can do the whole job, with the dialog box features. Isn't it?

In my second question, I think more generally how to adapt the C++ features to stata. For example, if I want to design a game in stata (I know this is not the main purpose of stata but I use it for illustration only), where the software interacts with the user, how to do that? In C++, for example, the a simple program will look like:

int main () { int x; cout << "Enter a value.\n"; cin >> x; cout << "You enter:/n"; cout << x; return 0; }

The whole thing is how to design an ado that interacts with the user? Is this doable in stata?

prog myprog ... di as txt "Enter a value." _n (the user enters a value) (now the question here is how my program reads the number and proceed accordingly?: through scalar, local, ...anything else?) (suppose we find a way to recuperate the value and save in a scalar x) di in gr "You enter: " in y x end

Best regards.

Amadou.

--------------------------------------------------

No doubt you could use a dialog to do this, but it doesn't strike me as the easiest approach. Be aware that -display- has a very simple interactive handle that could well be adequate here, namely -_request()-. To the question how do you design an interactive program in Stata, my answer is to design a syntax that you want to use! Nick n.j.cox@durham.ac.uk adiallo5@worldbank.org > 1. How to design a framework (possibly through a dialog box - > though I am > totally novice to dialogs - ) to make simulations, after a > regression? What I have in mind is something like: > > regress yvar xvar1 xvar2 > predict yhat1 > > Now allow user to make simulations: > > - replace xvar1 or xvar2 or both by some values > > predict yhat2. > > I am trying to do that with VB under excel (using streg > results), but not only > it is boring, I am sure it is doable in stata. > > 2. More generally, how to design an interractive program in > stata (in the sense > that during the course of the program, it receives inputs - arguments- > from the user and implement results). Something like the > cin/cout commands in > C++. Again possibly through a dialog box (such as a box to > compute the square > root of a number). But it can also be a stand alone program. > Something like: > > myprogram // in the stata command line > > enter a value // stata prompts a request > > 5 // user enters value > > 2.236068 // stata outputs an answer > > enter a new value or type "exit" to exit // stata prompts a > new request > > ... > > exit // end session > > > Again, I think I have to invest a lot in dialog programming, > but I want to know > if definitely, this is doable in stata (especially my first question). -------------------------------------------------------------------------------

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


Tag:


Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?