Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Command for Contingency table für transistion probabilities

    Hello Stata users,
    i have a file with fund data for several years. My main goal is to prove persistence. For doing that i want to use contingency tables. However, i have faced a problem in creating them, because i think i might not have enough stata knowledge and its quite hard to wrap the head around this idea, so please bear with me and i will have a screenshot attatched:
    Click image for larger version

Name:	Screenshot 2024-08-04 152213.png
Views:	1
Size:	106.5 KB
ID:	1760641


    First things first: i have "fundnr" which is the identifier of each fund; "excessr" which is the excess return on a monthly basis; "mean_excessr" which is the mean of excessr over all funds per year; ydate and mdate are variables for yearly date/monthly date; "dummy_performance" which tells me if monthly excessr of each fundnr is larger (=1) or smaller (=0) than the mean_excessr of the corresponding year.

    Now my goal is to get the transition probabilities for each mode of dummy_performance: 1-->1, 1-->0, 0-->1 and 0-->0. I tried tabulate however i could not figure out, how to state, that i want the number of good performance staying a good performance fore.g. each fund between ydate=2008 and ydate=2009. I know that i could simply use tabulate twice (one for 2008 and one for 2009) however there is some hundreds uf funds in my sample so it would take ages to count everything by hand.

    I need all this information so i can create a table with absolute numbers which is sortet like this (invented absolute numbers just for visualization):
    Click image for larger version

Name:	Screenshot 2024-08-04 153547.png
Views:	1
Size:	9.2 KB
ID:	1760642


    Is there any easy way to create the values i need?
    Thank you for your help and feel free to ask for further information if you need it.

    Kindly,
    Hugo
Working...
X