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

From |
"Thomas Jacobs" <thomasjacobs@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: re: beginning programming advice |

Date |
Mon, 15 Oct 2007 12:58:45 -0500 |

Dear Kit, Thanks very much for your reply. I have examined the optimize() function you mention in your first proposed solution. Can this be called to solve two functions simultaneously? I follow how one would call it to optimize a single function. Can you add any details on how it would be used for two functions each defined on similar variables as in my two equations in two unknowns problem? The panelsetup() you mention in solution two also looks very promising. Thanks again. Sincerely, Tom On 10/15/07, Kit Baum <baum@bc.edu> wrote: > Thomas says > > Here is a more detailed problem definition with two companies and one > year of trading data for each - I did not populate the sample > Accounting values(Acct), Market Equity (MktEq) or Equity Volatility > (EqVol) variables but they would have a value for each company and > trading day combination: > > Company, TradeDay, Acct1, Acct2, MktEq, EqVol > 1 1 > 1 2 > ... > 1 252 > 2 1 > ... > 2 252 > > On each day I am solving the following non-linear equations each of > which has one or more cumulative normal distribution functions > embedded in the right hand side and I have introduced the variables I > need to solve for: Market Value of Assets (MktAssets) and Asset > Volatility (AssetVol): > > MktEq = f(Acct1, Acct2, EqVol, MktAssets, AssetVol) > > EqVol = f(Acct1, Acct2, MktEq, MktAssets, AssetVol) > > I would then have a file or dataset in memory that appears as: > > Company, TradeDay, Acct1, Acct2, MktEq, EqVol, MktAssets, AssetVol > > for use in econometric modeling. > > > If you sort the dataset by day then firm, you can pass each day's > data to Mata in a view matrix of 252 x 8. You can then call -optimize > ()- to solve the equations involving those variables, and return the > results to Stata in whatever form would be useful to accumulate. For > instance, if there is one daily value that arises from the solution > of each equation, create a couple of new variables in Stata (with > missing values) and create a view matrix in Mata that fills in their > daily observations. > > As a fancier technique, you can use Mata's panelsetup() to tell Mata > that the data are defined in a perverse sort of panel with i and t > subscripts reversed: you have 252 panels each comprised of a number > of firms. Then you could just pass the entire dataset to Mata and run > the loop over trading days within Mata with one call. > > Kit > > Kit Baum, Boston College Economics and DIW Berlin > http://ideas.repec.org/e/pba1.html > An Introduction to Modern Econometrics Using Stata: > http://www.stata-press.com/books/imeus.html > > > * > * 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/ > -- Thomas Jacobs * * 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/

**References**:**st: re: beginning programming advice***From:*Kit Baum <baum@bc.edu>

- Prev by Date:
**Re: st: RE: r-square 4-level-logit-regression xtmelogit** - Next by Date:
**Re: st: Kolmogorov-Smirnov test** - Previous by thread:
**st: re: beginning programming advice** - Next by thread:
**st: Re: beginning programming advice** - Index(es):

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