• We are pleased to announce that the winner of our Feedback Prize Draw for the Winter 2024-25 session and winning £150 of gift vouchers is Zhao Liang Tay. Congratulations to Zhao Liang. If you fancy winning £150 worth of gift vouchers (from a major UK store) for the Summer 2025 exam sitting for just a few minutes of your time throughout the session, please see our website at https://www.acted.co.uk/further-info.html?pat=feedback#feedback-prize for more information on how you can make sure your name is included in the draw at the end of the session.
  • Please be advised that the SP1, SP5 and SP7 X1 deadline is the 14th July and not the 17th June as first stated. Please accept out apologies for any confusion caused.

Markov chain Paper B

Kanishka

Active Member
Can someone please help me understand the solution of bit (iv) of question 2.2 in Markov chain pbor? I am unable to understand the code.
 
Hello

Is this in the 2020 version of the questions? Do you mean the function in part (iv)(a)?

The idea behind the code is to calculate the expected income for each year and add them up. The function takes 4 inputs:
1. The probability transition matrix
2. The number of years that we want to calculate the premium income for minus 1
3. The starting distribution across the states
4. The percentage of the premium paid by drivers in each state.

The first line of the function calculates the premium for the first year by first multiplying the starting distribution vector by the vector containing the percentage of the premium paid by drivers in each state. When multiplying vectors together in R in this way, it returns a vector where each element is the product of the corresponding elements from the vectors being multiplied. The sum of the elements in this returned vector is then taken to give the overall average proportion of the full premium paid by all drivers. This sum is then multiplied by the full premium to get the monetary amount of the premium paid in the first year.

In the loop, for each subsequent year, the function first finds the expected distribution after the relevant number of transitions using the follow.driver function. Then the same calculation as above is performed but using the current expected distribution, rather than the starting distribution. Finally, each time this is done, we add the resulting premium income for that year to the overall running total.

Finally, the function returns the total calculated.

Hope this helps

Andy
 
Back
Top