Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This question is about Block 2 Part 5 . This question requires you to calculate values using Python functions. There are two approaches you can

This question is about Block 2 Part 5. This question requires you to calculate values using Python functions. There are two approaches you can use.Add suitable code to the provided file, then run it.Run the provided file first, to load the required function and data into memory, then do the calculation in the interactive Python shell.Feel free to choose the approach you prefer.The download folder for this TMA contains TM112_24D_TMA02_Q5_files.zip (go to TMA02- Python files and download TM112_24D_TMA02_Q5_files.zip and unzip the file). While you are working on this question, keep all the files in TM112_24D_TMA02_Q5_files together in that folder. Moving files out of the folder may result in some of the code not working.Scenario:You work as a data analyst for a government agency that is responsible for tracking population and migration trends across different regions of the UK. The agency has collected data on population estimates and new migrant GP registrations over several years for various regions. Your task is to calculate the mean population estimate for one particular region, and then to perform a correlation analysis to determine whether there is any relationship between the population estimates and the number of new migrant GP registrations in these regions.Open the folder TM112_24D_TMA02_Q5_files and inspect the contents of q5.py.The file contains two Python lists, each containing 10 values. These lists contain data about population estimates, in thousands, and new migrant GP registrations, in thousands, for England over a span of 10 years, ranging from 2011 to 2020.The list population contains population estimate in England by year and the list migrant_registration contains the new migrant GP registrations also by year. The data is from the Office for National Statistics (ONS,2021).As illustrated in Figure 1, the statistics include the period before the coronavirus (COVID-19) pandemic in the UK, specifically 2011 to 2020. The latest data includes a mix of data from pre-COVID time (up to March 2020) and from during the pandemic (April to December 2020). The restrictions in place during the 2020 lockdown in the UK had direct impacts on population change at the national level. Global restrictions also impacted the volume of international migration to and from the UK.Figure 1: The population estimate in England and the new migrant GP registrations between 2011 and 2020. The scale on left-hand vertical axis represents the population estimates, and that on the right-hand vertical axis represents new migrant GP registrations.a.q5.py imports the Python function mean() you used in Block 2 Part 5 to calculate the mean of a list of numbers.Use this function to find the mean of population.In your Solution document give the mean rounded (manually or using Python) to two decimal places. Also provide the Python code you used for calling the mean() function and explain how you executed it.(4 marks)b.In Section 5.1 you were introduced to Plyas four stage process for problem solving. Consider the first three stages and for each describe, in one or two sentences, how it relates to the task of finding the mean which you have just completed. The fourth stage is looking back and of course you are doing that when you answer this question part!(2 marks)c.The Python file q5.py imports the function corr_coef() which you used in Section 5.4of Block 2 Part 5 to calculate the correlation coefficient between two lists.i.Use this function to calculate the correlation coefficient between population and migrant_registration.In your Solution document, provide the resulting figure rounded (manually or using Python) to two decimal places. Also provide the Python code you used for calling the corr_coef() function and explain how you executed it.ii.Classify the size of the effect, following Table 5.4(Page 290) in Block 2 Part 5.iii.Briefly discuss whether any effect you have found is likely to be causal. Give one argument for it being causal and one against.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions