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, is already up and running.

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

RE: st: First passage problem

From   Jason Rosenberg <>
To   "" <>
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'
Then to perhaps obtain output like so:
egen [fit] = brown(varnameA), [define parameters]

From: [] on behalf of Scott Merryman []
Sent: Tuesday, September 11, 2012 9:02 PM
Subject: Re: st: First passage problem

It would help if you displayed your program and explained what type of
distribution you want to fit.


On Tue, Sep 11, 2012 at 8:40 AM, Jason Rosenberg <> 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:
### UNIVERSITY OF CAPE TOWN This e-mail is subject to the UCT ICT policies and e-mail disclaimer published on our website at 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:

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