Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

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

From |
Jason Rosenberg <RSNJAS002@myuct.ac.za> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: First passage problem |

Date |
Wed, 12 Sep 2012 11:42:58 +0000 |

I am tring to fit a curve to the probability distribution function of the investment horizons (?first passage times) measured in trading days. The data used to produce this are hp filtered logarithmic returns calculated from the historic daily closure prices. I want to fit the equation of the first passage problem solved for Brownian motion. p(t) = (1/(sqrt( _pi))*(a/t^(3/2))*exp(-(a^2/t)) And there is a more generalized expression that I cannot type in but for which I have tried to write a program that is so far not working. program define brown version 9.1 syntax newvarname=/exp [, roar(real sqrt(_pi)) ve(real 1) beta(real 0.5) alpha(real 1) tmain(varname) tzero(real 0)] for t main I would like to specify a varname, as in t main = varnameA if `ve' <= 0 | `beta' <= 0 | `alpha' <= 0 | `tzero' < 0 | `tmain' <= 0{ display as error "invalid parameters" exit 198 } tempname z g b e gen `z' = `ve'/`roar' gen `g' = (`beta'^(2*`alpha'))/(`tmain'+`tzero')^(`alpha'+1) gen `b' = -((`beta'^2)/(`tmain'+`tzero'))^`ve' gen `e' = exp(`b') gen `typlist' `varlist' = `z'*`g'*`e' end Then to perhaps obtain output like so: egen [fit] = brown(varnameA), [define parameters] ________________________________________ From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] on behalf of Scott Merryman [scott.merryman@gmail.com] Sent: Tuesday, September 11, 2012 9:02 PM To: statalist@hsphsun2.harvard.edu Subject: Re: st: First passage problem It would help if you displayed your program and explained what type of distribution you want to fit. Scott On Tue, Sep 11, 2012 at 8:40 AM, Jason Rosenberg <RSNJAS002@myuct.ac.za> wrote: > Dear Statalist members > > I am trying to write a program to solve the 'First Passage Problem' for geometric brownian motion. > > I have obtained my empirical pdf and want to fit a probability distribution to it. > I have my times and there accociated probabilities, i.e. 7 has a 0.0136452 chance of occuring. > > I am desperate for help, I have read much if the literature on the subject but cannot figure out how to apply these methods in Stata. > > To view the study I am replecating google: Johansen, A., Simonsen, . I. & Jensen, M. H., 2006. Optimal investment horizons for stocks and markets. Physica A, 370(1), p. 64–67. > > Any help would be greatly appreciated. > > I would be happy to provide any further explanation on what I require > > Kind Regards, > > Dalton Rosenberg. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ ### UNIVERSITY OF CAPE TOWN This e-mail is subject to the UCT ICT policies and e-mail disclaimer published on our website at http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from +27 21 650 9111. This e-mail is intended only for the person(s) to whom it is addressed. If the e-mail has reached you in error, please notify the author. If you are not the intended recipient of the e-mail you may not use, disclose, copy, redirect or print the content. If this e-mail is not related to the business of UCT it is sent by the sender in the sender's individual capacity. ### * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: First passage problem***From:*Jason Rosenberg <RSNJAS002@myuct.ac.za>

**Re: st: First passage problem***From:*Scott Merryman <scott.merryman@gmail.com>

- Prev by Date:
**Re: st: Calculation of attributable risk in surveys (SVY)** - Next by Date:
**st: weird behavior of append** - Previous by thread:
**Re: st: First passage problem** - Next by thread:
**st: option noomit not allowed** - Index(es):