Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Graph for longitudinal data - calculation based on mortality approach |
Date | Tue, 22 Feb 2011 11:23:02 +0000 |
The problem is not the graphics, as once you have created these results, the graph is standard. The problem is that you may need to code these calculations yourself. Some starter hints: The Stata function for the cumulative sum is -sum()- Cumulative products are often best calculated as -exp(sum(ln()))- so long as all arguments are positive. Nick On Tue, Feb 22, 2011 at 11:14 AM, Timo Beck <timoworldwide@gmx.de> wrote: > I have a question regarding graphs for longitudinal data. I am working with a data set on payments on outstanding loans in long format containing one observation for each person and payment of that person, i.e. > > Person Cum. Payment Loan Period > 1 10 50 3 > 1 20 50 7 > 1 30 50 8 > 2 100 500 2 > 2 200 500 17 > > I am trying to create a graph with the cumulative average fraction of the loan paid back over time (cumulative average over all persons). > > The mortality approach I want to use was introduced for bond defaults in Altman, E., 1989. Measuring Corporate Bond Mortality and Performance. Journal of Finance, 44, 909-922, p. 912.) and the calculation works as follows: > > Marginal fraction paid at time t (MFT)= Sum(all payments)/sum(all loans outstanding) at time t > > Fraction unpaid at t (FUT) = 1 - MFT > > Cumulative Fraction paid = 1 - product(previous FUT) > > > I am relatively new to Stata and not sure how to approach this problem. I tried several related ideas that I found in previous threats, e.g. transforming the data set in a person period form and go from there by using -xtgraph-. However, nothing worked so far. I use Stata 10 (Stata/SE 10.1 for Windows, Born 01 Oct 2009). > > I would be grateful for any hint on how to approach this. Thanks a lot in advance! * * 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/