London

5 Chancery Lane
London
WC2A 1LG
01235 821 160
View map

Edinburgh

1 Lochrin Square
92 Fountainbridge
Edinburgh
EH3 9QA
01235 821 160
View map

Dublin Office

77 Lower Camden Street
Dublin 2
Ireland
D 02 XE 80

View map

Administrative Office

BH Office
Church Street
Ardington
Wantage
Oxfordshire
OX12 8QA
01235 821 160
View map

Send us a message
CLOSE X
Contact Us

Cyber Security: SQL Injection

Here we calculate donations by blood type as follows:

Donations required per year = Total population * Proportion in blood group * 2.5%

Note that the annual donations required values do not quite add to 2,500,000, as would be expected, because of rounding of the blood group distribution percentages.

Thus, we can summarise the problem as follows. Given the distribution of blood types, the size of the eligible donor population, the limitations on who can donate to who, and the number of donations required for each blood group, how can we ensure that we have enough donations (with minimal wastage)?

A simple solution

On the face of it, this could be quite simple. We have estimated that 2,500,000 donations are required each year (2.5% of 100 million). An obvious solution is that we allow only donations from O Negative donors. Given that they can donate to all blood groups, we are guaranteed that the donations would be suitable, no matter the recipient. The issue however is that this would require approximately 40% of all eligible O Negative donors to donate blood each year (assuming donors only donate once per year). This seems rather ambitious!

A better solution – Part 1

Let’s reconsider and take a more systematic approach to the problem. Firstly, we use the above information, alongside our knowledge of who can donate to which blood group, to produce a range of the minimum and maximum donations required by donor blood group.

Note, the table above uses the following logic. For example:

The table in itself is not particularly useful given how large the ranges are in each blood group. However, they do allow us to gain insight into where potential shortfalls could lie – in particular, we need at least 5% of all eligible O Negative individuals to donate blood (again assuming donors only donate once per year). One would immediately want to question whether this is achievable and how these potential donors might be encouraged to donate blood. This analysis also paves the way for exploring other solutions, such as the one which follows.

A better solution – Part 2

Let us instead look at a solution which factors in the distribution of those eligible to donate blood and optimise to produce a realistic distribution of the required donations by type.

As a starting point, consider what would happen if the proportion of blood donors of each type were the same as in the whole population. Then, the amount of donations made by each blood group would be the same as in the first table.

If we had these numbers of donors then we could, hypothetically, guarantee that everyone requiring blood does indeed receive it. How can we be so sure? Well, we could allocate the donated blood so that the blood groups of the recipient and donor are the same – e.g. 200,000 B Positive donations are made which would all be allocated to B Positive recipients. As each blood group can donate to individuals of the same blood group, this would work for everyone. The additional benefit here is that we need an equal proportion of donations across each eligible blood group population (i.e. 5% of potential donors from each blood group need to donate – assuming once again that each donor donates once per year), and so we aren’t strained by attempting to recruit a higher proportion of donations from a specific blood group (like in our first solution where almost 40% of eligible O Negative individuals were required to donate blood each year).

However, this approach also has its drawbacks. For instance, in emergency situations we may not immediately have information on the recipient’s blood type and so would instead want to use O Negative blood as it is suitable for all recipients. We also should recall that the shelf life of donations is approximately 1 month, and so we require that for each blood group, the distribution through time of donations broadly matches the demand. Furthermore, if we allocate blood donations in this way then we also should consider the transport costs/logistics if there is a disparity between where donors and recipients are situated for each blood group. The solution is also idealistic; what if the proportion of donations by blood group naturally differs from 5%? How can we adjust the allocation so that everyone who needs blood receives it?

An even better solution

At this point, you may be thinking that there are far too many variables to generalise this problem – and I would agree. So, let’s take an actuarial perspective. And what do actuaries like doing most? Well of course that must be building models.

So, I went away and built a model in Excel which allows the user to play around with the various parameters that are involved in this problem. In particular, the user can change the assumptions and set the expected number of donations made by each blood group.

The challenge however is to see if the user can correctly distribute the received donations (see the ‘Donations & Distributions’ sheet of the tool) in order to ensure that everyone who requires blood donations does indeed receive them. When downloading the attached version of the tool, I have set the donations received numbers and you should look to edit the proportions in the ‘Donations & Distributions’ sheet so that you are successful. It may be that it is not solvable at all – but I encourage you to have a go for yourself to gain an insight into this problem and the potential challenges faced.

Additionally, I would encourage you to adjust the ‘Donations made by blood group per year’ column (within the ‘Donations & Distributions’ sheet) and consider the effect this has on the required distribution of donations. In particular, who are the ‘best’ type of donors? What do we even mean by ‘best’? Think also about what a reasonable distribution of donations could look like, in the real world.

Complexities

As alluded to earlier, the problem and tool showcased within this article are a simplification of the actual problem one may face (but no doubt should prove valuable insight into the dilemma) for many reasons. For instance, we may want to model stochastically the requirement of blood or even use a time series model. This would allow us to take into consideration the randomness of accidents and emergencies leading to blood requirements which could be combined with a more stable assumption about the needs of recipients who have more predictable, longer-term requirements. We could also build in allowance for differing levels of demand at various times of year.

And how about projecting the amount of donations? This too wouldn’t be uniform – could we use a time dependent model here? We also did not specify the relationship between the number of donors and the number of donations (the analysis within this article only considers the number of donations made). In fact, it is possible to donate roughly once every 12 (for men) to 16 (for women) weeks [3], and so our model could build in assumptions about the distribution and frequency of repeat donors.

There are also potentially transportation and additional logistical issues with regards to where the donors and recipients are located, particularly if the proportions of donors and recipients are not aligned locally. Would this mean that advertising needs to be targeted because for instance, it would be cheaper to pay everyone £10 for donating O Negative blood in London rather than transporting an excess from Edinburgh (for example)? Is this ethical?

It is also worth noting that it is better to have an excess which has uses in research and education, rather than to have a deficiency and risk patient welfare. However too much of an excess is also not beneficial because there would be costs related to the extraction of, and subsequent storage and disposal of, this unused blood.

Finally, as with any model, one should critically analyse and validate every aspect of it to ensure that it is suitable for the problem at hand (given I have just sat CP1, I could additionally list the requirements for building and validating a good model, but I will leave that as an exercise for the reader to think about).

Why give blood?

I wanted to conclude by discussing why it is important to donate blood if you can do so. I have been fortunate to not require such donations, but I have relatives who required blood following accidents, and I am thankful that they were able to have near immediate access to this.

As someone who decided to donate despite being utterly terrified of needles, I was surprised by how relatively painless the entire process was and would not have donated again were this not the case.

If for no other reason, then it is an opportunity for you to make a genuine difference to someone’s life (and their family).

If you are interested in donating (and live in the UK) then the following link will provide you with further information – Can I give blood? – NHS Blood Donation

The model used for this article can be downloaded by clicking the following link: Blood Donation Tool

Amar Gorania

January 2022

Footnotes

* It is also possible to donate platelets (which can be stored for up to 7 days) and plasma (which can be stored for up to 3 years).

Only those who are aged between 17-65 and meeting certain other requirements can give blood in the UK [3], so 50% of a developed country being eligible to give blood is a reasonable assumption.

This is reasonable given that the NHS estimates that approximately 5000 donations are required each day in the UK [2], which has a population of approximately 70 million. This equates to an ‘annual required blood donations relative to total population’ metric of 2.6%. [2]

References

[1] https://www.blood.co.uk/why-give-blood/blood-types/

[2] https://www.blood.co.uk/who-can-give-blood/can-i-give-blood/

[3] https://www.blood.co.uk/who-can-give-blood/

APR Charity Day 2021

The higher the value_season number, the better the players on a team performed relative to their cost. The top 5 contains title-winning Manchester City and 4 teams that were picked to do poorly and overperformed. The worst team in the division (excluding relegated sides) was Liverpool, who, being champions, had incredibly expensive players, but underperformed over the year.

There’s a common conception among managers of FPL that midfielders and forward score the big points, so provide the most value for money. In theory, this feels reasonable; the average forward on FPL costs £7m, midfielders £6m, whereas defenders and goalkeepers cost under £5m on average.

However, it is possible to get a view of how true this is by employing the same method as with teams above. This time, it is applied to playing position:

It transpires that the mark-up in cost for midfielders and forwards leads to them being comparatively low-value positions. By contrast, the goalkeeper position, if well chosen, can lead to a very good return for money, as is the case with defenders. Once again, the author feels mocked at this point. But a good takeaway from this? Don’t make goalkeepers the afterthought. It can be tempting to blow the entire budget on top quality midfielders, and then purchase the lowest cost goalkeeper to make books balance. However, selection of the right goalkeeper can really bring good value.

This article has covered broader thinking so far:

But knowing that a defender is worth investment does not make it easy to pick the right one. Understanding that Leeds United are basically a gold mine of value talent doesn’t mean a fantasy manager will win by picking their second-choice goalkeeper.

To get down to the question of who specifically should be picked, more specific data will need to be looked at.

For example, let’s try answering two questions:

  1. Which goalkeepers are the best value for money?
  2. Are there any undervalued midfielders?

For question 1, Python can once again be helpful in just a few lines of code. Using the pyplot library, it is possible to very quickly plot a scatter graph of goalkeepers. For the purposes of this analysis, only goalkeepers who scored above 100 points last season are included; this is to reduce the number of points on the graph and removing the low scorers seems reasonable.

The plot:

The plot above shows the goalkeepers in the Premier League, plotted by their cost for this season versus the number of points they gained last season. Remembering that value is defined as points/cost, in theory it is possible to draw an imaginary line of best fit. Above that line, all players are good value for money, that is to say, they get more points than expected for their cost. Below the line, players are less good value for money.

This plot has highlighted three specific players at three different price points:

To answer question 2, the term “undervalued” needs to be qualified. Usually, it would mean that the player is worth more than they cost; that is to say, similar to the positions analysis above, all three of those identified goalkeepers would be undervalued. However, in FPL mechanics, getting 10 points is only a definitive “good” result if a sufficient portion of competitors did worse. That is to say, if, for example, a player scores 5 goals in a game, picking them loses some value if everyone else picked them too.

As a result, for undervalued midfielders, the plot will not be points vs cost. Instead, it will plot the popularity of the player (by % of managers selected) against the value. The rationale here is that it is possible to aim for identifying the player that is very good value for money but that few people have identified as worth picking.

As these are midfielders, the plot was restricted to midfielders who cost above £7.0m (for this season) and only the best 20 by value are plotted to keep the graph legible.

The plot:

The plot above can give some insight into previous selection patterns. For example, Mohamed Salah is very good value for money, but is selected by 1 in 2 fantasy managers; therefore, selecting him is a good way to ensure other managers do not get a lead over you, but not a good way to create a lead over other managers. By contrast, Heung-Min Son is very good value for money, and is only selected by 1 in 5 managers, so might be a worthwhile risk to take on the rest of the field.

In general, the bottom right quadrant provides a list of players who are viable alternatives to the popular midfielders everyone already picks, and may even be better value for money if looking to save for a big purchase elsewhere. Other players to pick out include:

Conclusions

While the analysis performed above is not especially deep and will be subject to limitations, it illustrates how valuable insights can rapidly be gleaned from taking a closer look at the data. The key takeaways:

The code used to generate these results is available to any curious readers; just contact john.nicholls@aprllp.com for further information.

John Nicholls

September 2021

The End of the CAA Qualification – What does the future hold?

Parametric Insurance and Climate Change

Parametric insurance is a form of insurance that, whilst still relatively uncommon, is gaining greater prominence within the general insurance sector. In this article Rob Givens explains how parametric insurance differs from traditional indemnity insurance and, by way of some example case studies, highlights how it could become an increasingly important tool in dealing with the consequences of climate change.

READ MORE
April 2022 Exam Results

The April 2022 exam results have been published and APR student staff achieved an 89% pass rate across all IFoA exams taken. In this article, Jack Foley compares our performance with the industry average.

READ MORE
APR Charity Challenge 2022

APR recently held a Charity Challenge to raise donations for The Disaster Emergency Committee (DEC) through a virtual mission. In this article, Jenn Claybourn takes a look at the results, the money raised and the important cause this mission was for.

READ MORE
How to ruin tennis (a modelling sequel)

Ross Witney-Hunter and Josh Payne apply some statistical modelling techniques to try and predict the outcomes of this year’s Wimbledon singles competitions.

READ MORE
Wordle – how to maximise your chances of getting it in two

Thomas Pycroft examines the numbers behind Wordle and looks at the best strategy for maximising your chances of solving the puzzle in two guesses.

READ MORE
Consultation on Changes to Solvency II Regulation – What’s Included?

The latest step in the government’s plans to reform the Solvency II regime for the UK insurance sector has now been published. In this article Ross Gordon and Claire Grant provide details on these plans and potential knock-on effects.

READ MORE
Cyber Security: SQL Injection

SQL injection is a common type of attack carried out on databases. Despite its simplicity, SQL injection can have a number of serious consequences for databases that are not adequately protected. In this article John Nicholls introduces the concept of SQL injection and gives a number of steps organisations can take to avoid this type of attack.

READ MORE
Functional Programming

As actuaries, we often come at programming tasks with a very practical mindset, but there is a lot of theory out there that can be extremely useful to know about when weighing up potential solutions. In this article Joseph Barnett takes a look at functional programming, gives a brief overview of its history and discusses how it differs from other types of programming.

READ MORE
Actureads Book Club: The Transgender Issue

Following on from their inaugural meeting in November, APR’s Actureads book club reunited to discuss The Transgender Issue by Shon Faye. In this article, Curtis Anderson gives his key takeaways from the book and a selection of additional resources for anyone interested in exploring the topic further.

READ MORE
Key Drivers of Client Demand

Ross Gordon discusses the key current drivers of demand for APR’s services, as well as touching on some that have the potential to be key drivers in the near future.

READ MORE