Using R to enhance your data for better planning and forecasting

‘R’ is an open-source, free programming language used for statistics and data analysis. Users write their own functions within R then upload them for other people to use, meaning the options for NHS data analysts are almost endless.  ICHP introduces R and looks at the planning and forecasting benefits it could bring to CCGs.

Statistical and data analysis is a key part of enabling NHS clinicians, providers and commissioners to properly plan and set budgets. Annual plans and service level agreements all need to be informed by accurate data from previous years’ performances, and so data plays a major role in determining the success or otherwise of NHS services.

Anything which can ease the burden on NHS planners is always worth serious consideration, and it’s an area in which ICHP can provide some expert support, particularly through the ‘R’ environment.

R is a free programming language commonly used for statistics and data analysis. It’s an open-source environment in which code-writing users can create their own data analysis tools and solutions and then upload them for others to use. It’s a kind of free code community and environment which is already providing some excellent solutions entirely applicable for use within the NHS. Put simply, code can be picked up in the R environment and then used for your own data analysis.

One of the programme’s real strengths is the ease with which data analytics solutions and the mathematics and formulae behind them can be produced.

It’s free and can be run on a variety of common platforms including Windows and MacOS. Within the R environment, users will find software to help them build an effective data handling and storage facility, a range of data analytics tools and ways to present data analysis clearly using graphics for both online and offline use. It’s a simple and effective programming language offering scope for bespoke additions.

We think it can offer some real benefits for NHS planners.

As an example, historical data and population predictions can be filtered through R to provide and display realistic forecasts of activity and capacity for clinical commissioning groups (CCGs). This could help to predict seasonal demands and potential peaks of NHS activity within the CCG.

Data could be fed into R from the publicly available Hospital Episode Statistics database, which holds national data on all activity related to hospital visits, and the Whole Systems Integrated Care database, which stores whole-pathway data for patients within NWL CCGs. The population predictions come from the Office for National Statistics, which provides population figures over a 25-year period by age group and sex for local authorities.

Different levels of detail are available, helping commissioners and clinicians to define areas or groups that might warrant attention so, for example, weather forecasts could even be added to help predict winter admission peaks and likely system stress points.
The data from these multiple sources can be linked by multivariate, i.e. observation and analysis of more than one statistical outcome variable at a time, forecasts calculated in R to aid interpretation of the data.

If used alongside Tableau (visual analytics drag and drop software which allows data generated in R to be interpreted and displayed), the data can be easily managed and presented via a series of dashboards. Data sources are not limited and can range from locally saved files and databases to big data accessed via external data warehouses.

Essentially, R does the complicated maths and formulations while Tableau displays the results in a way that is easy to manage and use.

Here at ICHP, we use Tableau to enhance the statistical analytics performed in R by creating these easy-to-understand dashboards where data can be visualised overall and filtered by specific factors (e.g. age group or socioeconomic group).

However you use data, we believe the whole process can be enhanced and simplified through the R environment; it offers deeper data insight options and is a free to use resource. As users of the system we’re able to advise and offer options about how to get started.

By Dr Ellie Johnston, Data Analyst.