The Correlation Coefficient Between Age and Infection Risk Python Coding Task
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_22D_TMA02_Q5_files.zip (go to TMA02 - Python files and download TM112_22D_TMA02_Q5_files.zip and unzip the file). While you are working on this question, keep all the files in TM112_22D_TMA02_Q5_files together in that folder. Moving files out of the folder may result in some of the code not working.
Open the folder TM112_22D_TMA02_Q5_files and inspect the contents of q5.py
The file contains two Python lists, each containing 70 values. These lists contain data about the estimated risk of infection following vaccination by a single year of age in the UK.
The TMA02 - Python files data set is from the Office for National Statistics (Office for National Statistics, June 2021)
The list age holds data about the years of age. The list risk holds data about the estimated risk of infection following vaccination by single year of age, collected between 1 December 2020 and 31 May 2021. All estimates are subject to uncertainty, given that a sample is only part of the wider population.
These statistics show that the estimated risk of infection decreases with age. For example, for vaccinated people, the risk of infection to those aged 55 is half compared to the 16-year-old.
- a.q5.py imports the Python function mean() you used in Block 2 Part 5 to calculate the median of a list of numbers.Use this function to find the mean of age.In your Solution document give the mean. Also provide the Python code you used for calling the mean() function and explain how you executed it.(4 marks)
- b.The Python file q5.py imports the function corr_coef() which you used in Section 5.4 of Block 2 Part 5 to calculate the correlation coefficient between two lists.
- i.Use this function to calculate the correlation coefficient between age and risk.In your Solution document, provide the resulting figure rounded manually to two decimal places. Solutions which use Python to round the result will not gain credit. Also provide the Python code you used for calling the corr_coef() function and explain how you executed it.
- ii.Give the level of correlation, 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.The maximum word limit for Question 5.b(iii) is 100 words.(10 marks)(Total 14 marks)
References
Office for National Statistics (2021) Coronavirus (COVID-19) Infection Survey technical article: analysis of positivity after vaccination data: 17 June. Available at: https://www.ons.gov.uk/ peoplepopulationandcommunity/ healthandsocialcare/ conditionsanddiseases/ datasets/ coronaviruscovid19infectionsurveytechnicalarticleanalysisofpositivityaftervaccinationdata (Accessed: 24 August 2021).
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.