IDEAS home Printed from https://ideas.repec.org/a/spr/compst/v39y2024i6d10.1007_s00180-023-01437-2.html
   My bibliography  Save this article

Pair programming with ChatGPT for sampling and estimation of copulas

Author

Listed:
  • Jan Górecki

    (Silesian University in Opava)

Abstract

Without writing a single line of code by a human, an example Monte Carlo simulation-based application for stochastic dependence modeling with copulas is developed through pair programming involving a human partner and a large language model (LLM) fine-tuned for conversations. This process encompasses interacting with ChatGPT using both natural language and mathematical formalism. Under the careful supervision of a human expert, this interaction facilitated the creation of functioning code in MATLAB, Python, and R. The code performs a variety of tasks including sampling from a given copula model, evaluating the model’s density, conducting maximum likelihood estimation, optimizing for parallel computing on CPUs and GPUs, and visualizing the computed results. In contrast to other emerging studies that assess the accuracy of LLMs like ChatGPT on tasks from a selected area, this work rather investigates ways how to achieve a successful solution of a standard statistical task in a collaboration of a human expert and artificial intelligence (AI). Particularly, through careful prompt engineering, we separate successful solutions generated by ChatGPT from unsuccessful ones, resulting in a comprehensive list of related pros and cons. It is demonstrated that if the typical pitfalls are avoided, we can substantially benefit from collaborating with an AI partner. For example, we show that if ChatGPT is not able to provide a correct solution due to a lack of or incorrect knowledge, the human-expert can feed it with the correct knowledge, e.g., in the form of mathematical theorems and formulas, and make it to apply the gained knowledge in order to provide a correct solution. Such ability presents an attractive opportunity to achieve a programmed solution even for users with rather limited knowledge of programming techniques.

Suggested Citation

  • Jan Górecki, 2024. "Pair programming with ChatGPT for sampling and estimation of copulas," Computational Statistics, Springer, vol. 39(6), pages 3231-3261, September.
  • Handle: RePEc:spr:compst:v:39:y:2024:i:6:d:10.1007_s00180-023-01437-2
    DOI: 10.1007/s00180-023-01437-2
    as

    Download full text from publisher

    File URL: http://link.springer.com/10.1007/s00180-023-01437-2
    File Function: Abstract
    Download Restriction: Access to the full text of the articles in this series is restricted.

    File URL: https://libkey.io/10.1007/s00180-023-01437-2?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    As the access to this document is restricted, you may want to search for a different version of it.

    References listed on IDEAS

    as
    1. Hirofumi Michimae & Takeshi Emura, 2022. "Likelihood Inference for Copula Models Based on Left-Truncated and Competing Risks Data from Field Studies," Mathematics, MDPI, vol. 10(13), pages 1-15, June.
    2. Alexander J. McNeil & Rüdiger Frey & Paul Embrechts, 2015. "Quantitative Risk Management: Concepts, Techniques and Tools Revised edition," Economics Books, Princeton University Press, edition 2, number 10496.
    Full references (including those not matched with items on IDEAS)

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Abduraimova, Kumushoy, 2022. "Contagion and tail risk in complex financial networks," Journal of Banking & Finance, Elsevier, vol. 143(C).
    2. Tobias Fissler & Yannick Hoga, 2024. "How to Compare Copula Forecasts?," Papers 2410.04165, arXiv.org.
    3. Masahiko Egami & Rusudan Kevkhishvili, 2020. "Time reversal and last passage time of diffusions with applications to credit risk management," Finance and Stochastics, Springer, vol. 24(3), pages 795-825, July.
    4. Avanzi, Benjamin & Taylor, Greg & Wong, Bernard & Yang, Xinda, 2021. "On the modelling of multivariate counts with Cox processes and dependent shot noise intensities," Insurance: Mathematics and Economics, Elsevier, vol. 99(C), pages 9-24.
    5. Pfeifer Dietmar & Mändle Andreas & Ragulina Olena, 2017. "New copulas based on general partitions-of-unity and their applications to risk management (part II)," Dependence Modeling, De Gruyter, vol. 5(1), pages 246-255, October.
    6. Diba Daraei & Kristina Sendova, 2024. "Determining Safe Withdrawal Rates for Post-Retirement via a Ruin-Theory Approach," Risks, MDPI, vol. 12(4), pages 1-21, April.
    7. Makam, Vaishno Devi & Millossovich, Pietro & Tsanakas, Andreas, 2021. "Sensitivity analysis with χ2-divergences," Insurance: Mathematics and Economics, Elsevier, vol. 100(C), pages 372-383.
    8. Nevrla, Matěj, 2020. "Systemic risk in European financial and energy sectors: Dynamic factor copula approach," Economic Systems, Elsevier, vol. 44(4).
    9. H. Kaibuchi & Y. Kawasaki & G. Stupfler, 2022. "GARCH-UGH: a bias-reduced approach for dynamic extreme Value-at-Risk estimation in financial time series," Quantitative Finance, Taylor & Francis Journals, vol. 22(7), pages 1277-1294, July.
    10. Battulga Gankhuu, 2022. "Merton's Default Risk Model for Private Company," Papers 2208.01974, arXiv.org.
    11. Saminger-Platz Susanne & Kolesárová Anna & Šeliga Adam & Mesiar Radko & Klement Erich Peter, 2024. "On comprehensive families of copulas involving the three basic copulas and transformations thereof," Dependence Modeling, De Gruyter, vol. 12(1), pages 1-36.
    12. Stephan Schlüter & Fabian Menz & Milena Kojić & Petar Mitić & Aida Hanić, 2022. "A Novel Approach to Generate Hourly Photovoltaic Power Scenarios," Sustainability, MDPI, vol. 14(8), pages 1-16, April.
    13. Borowska, Agnieszka & Hoogerheide, Lennart & Koopman, Siem Jan & van Dijk, Herman K., 2020. "Partially censored posterior for robust and efficient risk evaluation," Journal of Econometrics, Elsevier, vol. 217(2), pages 335-355.
    14. Dietmar Pfeifer & Olena Ragulina, 2018. "Generating VaR Scenarios under Solvency II with Product Beta Distributions," Risks, MDPI, vol. 6(4), pages 1-15, October.
    15. E. Ramos-P'erez & P. J. Alonso-Gonz'alez & J. J. N'u~nez-Vel'azquez, 2020. "Forecasting volatility with a stacked model based on a hybridized Artificial Neural Network," Papers 2006.16383, arXiv.org, revised Aug 2020.
    16. Gorgi, P. & Koopman, S.J., 2023. "Beta observation-driven models with exogenous regressors: A joint analysis of realized correlation and leverage effects," Journal of Econometrics, Elsevier, vol. 237(2).
    17. Dimitris Bertsimas & Agni Orfanoudaki, 2021. "Algorithmic Insurance," Papers 2106.00839, arXiv.org, revised Dec 2022.
    18. Xuehai Zhang, 2019. "Value at Risk and Expected Shortfall under General Semi-parametric GARCH models," Working Papers CIE 123, Paderborn University, CIE Center for International Economics.
    19. Paolo Vanini & Sebastiano Rossi & Ermin Zvizdic & Thomas Domenig, 2023. "Online payment fraud: from anomaly detection to risk management," Financial Innovation, Springer;Southwestern University of Finance and Economics, vol. 9(1), pages 1-25, December.
    20. Claudia Ceci & Katia Colaneri & Rdiger Frey & Verena Kock, 2019. "Value adjustments and dynamic hedging of reinsurance counterparty risk," Papers 1909.04354, arXiv.org.

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:spr:compst:v:39:y:2024:i:6:d:10.1007_s00180-023-01437-2. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Sonal Shukla or Springer Nature Abstracting and Indexing (email available below). General contact details of provider: http://www.springer.com .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.