Question
4. Consider a group of 200 people, 100 of whom at the moment support the Labour Party and 100 of whom support the Conservative Party.
4. Consider a group of 200 people, 100 of whom at the moment support the Labour Party and 100 of whom support the Conservative Party. Assume that the probability that a Labour supporter changes to a Conservative supporter any month is 0.015, while the probability that a Conservative supporter changes to a Labour supporter is 0.01.
a Suppose we want to simulate how the number of Conservative and Labour Party supporters changes over time. Write R code that computes and stores the number of Labour and Conservative Party supporters each month for the next 10 years.
Hint: The outcome should be two vectors of length 121 with the following structure:
Labour = (No. of initial Labour supporters(= 100),
No. of Labour party supporters after 1 month,
No. of Labour party supporters after 2 months,
. . . , No. of Labour party supporters after 120 months)
and similarly for the Conservative Party.
(this is the data for Qb https://docs.google.com/document/d/13T5C6OQTPcIr0rOYK6tpU7PjwtpQeWPa9dEmdjXsWk4/edit?usp=sharing)
b Plot how the number of Conservative and Labour Party supporters changes over time.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started