1 option
R programming for actuarial science / Peter McQuire, Alfred Kume.
- Format:
- Book
- Author/Creator:
- McQuire, Peter, author.
- Language:
- English
- Subjects (All):
- R (Computer program language).
- Actuarial science.
- Physical Description:
- 1 online resource illustrations.
- Edition:
- 1st edition
- Place of Publication:
- Newark : John Wiley & Sons, Incorporated, 2023.
- Summary:
- "The purpose of this chapter is to introduce the fundamentals of the R programming language, and the basic tools you will need to use this book; it is therefore an important chapter for readers new to R. The reader is advised, following reading this chapter, to proceed to Chapter 2 which, together with this chapter, forms our introduction to programming in R. R is an exceptional statistical computing tool which is increasingly used by researchers and students in many disciplines. R is an open-source language which one can use without purchasing a licence, and contribute to solving problems within the vast R community."-- Provided by publisher.
- Contents:
- Intro
- R Programming for Actuarial Science
- Contents
- About the Companion Website
- Introduction
- 1 Main Objectives of This Book
- 2 Who Is This Book For?
- 3 How to Use This Book
- 4 Book Structure
- 5 Chapter Style
- 6 Examples and Exercises
- 7 Verification of Code and Calculations - Best Practice
- 8 Website: www.wiley.com/go/rprogramming.com
- 9 R or Microsoft Excel?
- 10 Caveats
- 11 Acknowledgements
- 1 R : What You Need to Know to Get Started
- 1.1 Introduction
- 1.2 Getting Started: Installation of R and RStudio
- 1.2.1 Installing R
- 1.2.2 What Is RStudio?
- 1.2.3 Inputting R Commands
- 1.3 Assigning Values
- 1.4 Help in R
- 1.5 Data Objects in R
- 1.6 Vectors
- 1.6.1 Numeric Vectors
- 1.6.2 Logical Vectors
- 1.6.3 Character Vectors
- 1.6.4 Factor Vectors
- 1.7 Matrices
- 1.8 Dataframes
- 1.9 Lists
- 1.10 Simple Plots and Histograms
- 1.11 Packages
- 1.12 Script Files
- 1.13 Workspace, Saving Objects, and Miscellany
- 1.14 Setting YourWorking Directory
- 1.15 Importing and Exporting Data
- 1.15.1 Importing Data
- 1.15.2 Exporting Data
- 1.16 Common Errors Made in Coding
- 1.17 Next Steps
- 1.18 Recommended Reading
- 1.19 Appendix: Coercion
- 2 Functions in R
- 2.1 Introduction
- 2.1.1 Objectives
- 2.1.2 Core and Package Functions
- 2.1.3 User-Defined Functions
- 2.2 An Introduction to Applying Core and Package Functions
- 2.2.1 Examples of Simple, Common Functions
- 2.3 User-Defined Functions
- 2.3.1 What does a "udf" consist of?
- 2.3.2 Naming Conventions
- 2.3.3 Examples and Exercises
- 2.4 Using Loops in R - the "for" Function
- 2.5 Integral Calculus in R
- 2.5.1 The "Integrate" Function
- 2.5.2 Numerical Integration
- 2.6 Recommended Reading
- 3 Financial Mathematics (1): Interest Rates and Valuing Cashflows
- 3.1 Introduction
- 3.2 The Force of Interest.
- 3.3 Present Value of Future Cashflows
- 3.4 Instantaneous Forward Rates and Spot Rates
- 3.5 Non-Constant Force of Interest
- 3.5.1 Discrete Cashflows
- 3.5.2 Cashflows Which Are Continuous
- 3.6 Effective and Nominal Rates of Interest
- 3.6.1 Effective Rates of Interest
- 3.6.2 Why DoWe Use Effective Rates?
- 3.6.3 Nominal Interest Rates
- 3.7 Appendix: Force of Interest - An Analogy with Mortality Rates
- 3.8 Recommended Reading
- 4 Financial Mathematics (2): Miscellaneous Examples
- 4.1 Introduction
- 4.2 Writing Annuity Functions
- 4.2.1 Writing a function for an annuity certain
- 4.3 The 'presentValue' Function
- 4.4 Annuity Function
- 4.5 Bonds - Pricing and Yield Calculations
- 4.6 Bond Pricing: Non-Constant Interest Rates
- 4.7 The Effect of Future Yield Changes on Bond Prices Throughout the Term of the Bond
- 4.8 Loan Schedules
- 4.8.1 Introduction
- 4.8.2 Method 1
- 4.8.3 Method 2
- 4.9 Recommended Reading
- 5 Fundamental Statistics: A Selection of Key Topics
- 5.1 Introduction
- 5.2 Basic Distributions in Statistics
- 5.3 Some Useful Functions for Descriptive Statistics
- 5.3.1 Introduction
- 5.3.2 Bivariate or Higher Order Data Structure
- 5.4 Statistical Tests
- 5.4.1 Exploring for Normality or Any Other Distribution in the Data
- 5.4.2 Goodness-of-fit Testing for Fitted Distributions to Data
- 5.4.2.1 Continuous distributions
- 5.4.2.2 Discrete distributions
- 5.4.3 T-tests
- 5.4.3.1 One sample test for the mean
- 5.4.3.2 Two sample tests for the mean
- 5.4.4 F-test for Equal Variances
- 5.5 Main Principles of Maximum Likelihood Estimation
- 5.5.1 Introduction
- 5.5.2 MLE of the Exponential Distribution
- 5.5.2.1 Obtaining the MLE numerically using R
- 5.5.2.2 Obtaining the MLE analytically
- 5.5.3 Large Sample (Asymptotic) Properties of MLE.
- 5.5.4 Fitting Distributions to Data in R Using MLE
- 5.5.5 Likelihood Ratio Test, LRT
- 5.6 Regression: Basic Principles
- 5.6.1 Simple Linear Regression
- 5.6.2 Quantifying Uncertainty on
- 5.6.3 Analysis of Variance in Regression
- 5.6.3.1 R2 and adjusted R2 Coefficient of Determination
- 5.6.4 Some Visual Diagnostics for the Proposed Simple Regression Model
- 5.7 Multiple Regression
- 5.7.1 Introduction
- 5.7.2 Regression and MLE
- 5.7.2.1 Multivariate Regression
- 5.7.3 Tests
- 5.7.3.1 Likelihood Ratio Test in Regression
- 5.7.3.2 Akaike Information Criterion: AIC
- 5.7.3.3 AIC and Regression model selection
- 5.7.3.4 Bayesian Information Criterion: BIC
- 5.7.4 Variable Selection, Finding the Most Appropriate Sub-Model
- 5.7.5 Backward Elimination
- 5.7.6 Forward Selection
- 5.7.7 Using AIC/BIC Criteria
- 5.7.8 LRT in Model Selection
- 5.7.9 Automatic Search Using R-squared Criteria
- 5.7.10 Concluding Remarks on Test Data
- 5.7.11 Modelling Beyond Linearity
- 5.8 Dummy/Indicator Variable Regression
- 5.8.1 Introducing Categorical Variables
- 5.8.2 Continuous and Indicator Variable Predictors - Including Load in the Model
- 5.9 Recommended Reading
- 6 Multivariate Distributions, and Sums of Random Variables
- 6.1 Multivariate Distributions - Examples in Finance
- 6.2 Simulating Multivariate Normal Variables
- 6.3 The Summation of a Number of Random Variables
- 6.4 Conclusion
- 6.5 Recommended Reading
- 7 Benefits of Diversification
- 7.1 Introduction
- 7.2 Background
- 7.3 Key Mathematical Ideas
- 7.4 Running Simulations
- 7.5 Recommended Reading
- 8 Modern Portfolio Theory
- 8.1 Introduction
- 8.2 2-Asset Portfolio
- 8.3 3-Asset Portfolio
- 8.4 Introduction of a Risk-free Asset to the Portfolio
- 8.4.1 Adding a Risk-free Asset
- 8.4.2 Capital Market Line and the Sharpe Ratio.
- 8.4.3 Borrowing to Obtain Higher Returns
- 8.5 Appendix: Lagrange Multiplier Method
- 8.6 Recommended Reading
- 9 Duration - A Measure of Interest Rate Sensitivity
- 9.1 Introduction
- 9.2 Duration - Definitions and Interpretation
- 9.3 Duration Function in R
- 9.4 Practical Applications of Duration
- 9.5 Recommended Reading
- 10 Asset-Liability Matching: An Introduction
- 10.1 Introduction
- 10.2 What Interest Rates Do Institutions Use To Measure Their Liabilities?
- 10.3 Variance of the Solvency Position
- 10.4 Characteristics of Various Asset Classes and Liabilities
- 10.5 Our Scenarios
- 10.6 Results
- 10.7 Simulations
- 10.8 Exercise and Discussion - an Insurer With Predominately Short-Term Liabilities
- 10.9 Potential Exercise
- 10.10 Conclusions
- 10.11 Recommended Reading
- 11 Hedging: Protecting Against a Fall in Equity Markets
- 11.1 Introduction
- 11.2 Our Example
- 11.2.1 Futures Contracts - A Brief Explanation
- 11.2.2 Our Task
- 11.3 Adopting a Better Hedge
- 11.4 Allowance for Contract and Portfolio Sizes
- 11.5 Negative Hedge Ratio
- 11.6 Parameter and Model Risk
- 11.7 A Final Reminder on Hedging
- 11.8 Recommended Reading
- 12 Immunisation - Redington and Beyond
- 12.1 Introduction
- 12.2 Outline of Redington Theory and Alternatives
- 12.3 Redington's Theory of Immunisation
- 12.4 Changes in the Shape of the Yield Curve
- 12.5 A More Realistic Example
- 12.5.1 Determining a Suitable Bond Allocation
- 12.5.2 Change in Yield Curve Shape
- 12.5.3 Liquidity Risk
- 12.6 Conclusion
- 12.7 Recommended Reading
- 13 Copulas
- 13.1 Introduction
- 13.2 Copula Theory - The Basics
- 13.3 Commonly Used Copulas
- 13.3.1 The Independent Copula
- 13.3.2 The Gaussian Copula
- 13.3.3 Archimedian Copulas
- 13.3.4 Clayton Copula
- 13.3.5 Gumbel Copula
- 13.4 Copula Density Functions.
- 13.5 Mapping from Copula Space to Data Space
- 13.6 Multi-dimensional Data and Copulas
- 13.7 Further Insight into the Gaussian Copula: A Non-rigorous View
- 13.8 The Real Power of Copulas
- 13.9 General Method of Fitting Distributions and Simulations - A Copula Approach
- 13.9.1 Fitting the Model
- 13.9.2 Simulating Data Using the mvdc and rMvdc Functions
- 13.10 How Non-Gaussian Copulas Can Improve Modelling
- 13.11 Tail Correlations
- 13.12 Exercise (Challenging)
- 13.13 Appendix 1 - Copula Properties
- 13.14 Appendix 2 - Rank Correlation and Kendall's Tau,
- 13.15 Recommended Reading
- 14 Copulas - A Modelling Exercise
- 14.1 Introduction
- 14.2 Modelling Future Claims
- 14.2.1 Data
- 14.2.2 Fitting Appropriate Marginal Distributions
- 14.2.3 Fitting The Copula
- 14.2.4 Assessing Risk From the Analysis of Simulated Values
- 14.2.5 Comparison with the Gaussian Copula Model
- 14.2.6 Comparison of the Models with the Data
- 14.3 Another Example: Banking Regulator
- 14.4 Conclusion
- 15 Bond Portfolio Valuation: A Simple Credit Risk Model
- 15.1 Introduction
- 15.2 Our Example Bond Portfolio
- 15.2.1 Description
- 15.2.2 The Transition Matrix
- 15.2.3 Correlation Matrix
- 15.2.4 Simulations and Results
- 15.2.5 Incorporating Interest Rate Risk - A Simple Adjustment
- 15.2.6 Portfolio Consisting of Highly Correlated Bonds
- 15.3 Further Development of this Model
- 15.4 Recommended Reading
- 16 The Markov 2-State Mortality Model
- 16.1 Introduction
- 16.2 Markov 2-State Model
- 16.3 Simple Applications of the 2-State Model
- 16.4 Estimating Mortality Rates from Data
- 16.5 An Example: Calculating Mortality Rates for One Age Band
- 16.6 Uncertainty in Our Estimates
- 16.7 Next Steps?
- 16.8 Appendices
- 16.8.1 Informal Discussion of
- 16.8.2 Intuitive meaning of ( )
- 16.9 Recommended Reading
- 17 Approaches to Fitting Mortality Models: The Markov 2-state Model and an Introduction to Splines.
- Notes:
- Description based on publisher supplied metadata and other sources.
- Other Format:
- Print version: McQuire, Peter R Programming for Actuarial Science
- ISBN:
- 9781119755005
- 111975500X
- 9781119754985
- 1119754984
- OCLC:
- 1406768156
The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.