Announcement

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

  • Exporting multiple wntestq (Ljung-Box test) results with panel data

    Hello. I want to export the resulting tables from a loop of portmanteau / Ljung-Box tests (wntestq). I have a panel dataset with 571 CRSP mutual fund numbers as panel variable, and a monthly date variable. An example of the first 5 obs for fund '3211' and for fund '3222' can be seen below. The number of observations vary between funds.
    Until now, I seem to have managed to get the correct results, but it is not in the export format that I desire. I would like to export to Excel rather than word, but asdoc is the only thing that has worked for me:

    levelsof crsp_fundno, local(crsp_fundnos)
    foreach i of local crsp_fundnos {
    asdoc wntestq resid if crsp_fundno==`i', lag(4)
    }


    Further, this takes a long time to compute, as you can imagine, because it appends the result to the file for each loop. Thus, how can I run a wntestq for all the fund IDs and save the results to an Excel file? I have to count the number of significant Q statistics, for why I see Excel as most efficient.

    Please let me know if I have to clarify something.

    +----------------------+
    | crsp_f~o resid |

    |----------------------|

    1. | 3211 .176571 |

    2. | 3211 -.0386347 |

    3. | 3211 .0246942 |

    4. | 3211 .0169404 |

    5. | 3211 .0559084 |

    |----------------------|
    236. | 3222 .0597542 |
    237. | 3222 -.0090914 |
    238. | 3222 .0242066 |
    239. | 3222 .0097544 |
    240. | 3222 .0078386 |




Working...
X