toolkit

 

R Examples For Actuaries - Introduction

Page history last edited by Anonymous 3 yrs ago

An Introduction to R: Examples for Actuaries

 

Nigel De Silva (nigel.desilva@thomasmiller.com)


Back to: Contents

Forward to: Some Preliminaries


1.0 Introduction

 

This is a very brief introduction to R via a series of examples which are relevant to actuarial work. These examples are aimed at R “newbies” so:

 

  • only a small fraction of R’s capabilities are examined in these examples.

 

  • there are many ways of achieving the same objective in R. These examples often only consider a single approach and for educational purposes may not be the most elegant solutions.

 

This document is no substitute to the many excellent resources available online and it is strongly recommended that you review these. For example, a much more comprehensive introduction to R is provided in Using R for Data Analysis and Graphics – Introduction, Code and Commentary by J H Maindonald.


1.1 What is R?

 

R is an integrated suite of software facilities for data manipulation, calculation and graphical display. Among other things it has:

 

  • an effective data handling and storage facility,
  • a suite of operators for calculations on arrays, in particular matrices,
  • a large, coherent, integrated collection of intermediate tools for data analysis,

graphical facilities for data analysis and display either on-screen or on hardcopy, and

  • a well-developed, simple and effective programming language which includes conditionals, loops, user-defined recursive functions and input and output facilities.

 

R can be regarded as an implementation of the S language which was developed at Bell Laboratories and forms the basis of the S-Plus systems.

 

R is available here as Free Software under the terms of the Free Software Foundation's GNU General Public License. It runs on a wide variety of UNIX platforms and similar systems (including FreeBSD and Linux), Windows and MacOS.


1.2 R Packages

 

So far we have not mentioned statistics, yet many people use R as a statistics system. R’s developers prefer to think of it of an environment within which many classical and modern statistical techniques have been implemented. A few of these are built into the base R environment, but many are supplied as packages.

 

All R functions and datasets are stored in packages. For instance, in section 3.4, we use a package called “evir”, which contains a number of useful functions for conducting extreme value analysis. Only when a package is loaded are its contents available. This greatly improves R’s efficiency as it doesn’t have to store the many thousands of potential commands available in the hundreds of available packages.

 

There are about 25 packages supplied with R (called “standard” and “recommended” packages) and many more are available through the CRAN family of Internet sites and elsewhere.

 

Packages can be installed and loaded via the Package menu item, or though R commands.


1.3 Online Resources

 

The R project homepage contains contributed documents and manuals from various authors.

 

The GIRO Toolkit Working Party has an R toolkit page of its wiki, that discusses some online R resources. In particular:

 

a Google search including the term “R”, usually results in some useful results.

 

The social book marking website Del.icio.us search produces more useful general links:

a) The most popular R sites bookmarked on delicious

b) All R tags on delicious (good for seeing what's just been tagged)


Back to: Contents

Forward to: Some Preliminaries


Comments (0)

You don't have permission to comment on this page.