Explanation & Answer length: 8 Questions1 attachmentsSlide 1 of 1

- attachment_1attachment_1

### UNFORMATTED ATTACHMENT PREVIEW

ANL252 Python for Data Analytics Tutor-Marked Assignment July 2021 Presentation ANL252 Tutor-Marked Assignment TUTOR-MARKED ASSIGNMENT (TMA) This assignment is worth 18% of the final mark for ANL252 Python for Data Analytics. The cut-off date for this assignment is 8 August 2021, 2355hrs. Up to 25 marks of penalties will be imposed for inappropriate or poor paraphrasing. For serious cases, they will be investigated by the examination department. More information on effective paraphrasing strategies can be found on https://academicguides.waldenu.edu/writingcenter/evidence/paraphrase/effective. Note to Students: You are to include the following particulars in your submission: Course Code, Title of the TMA, SUSS PI No., Your Name, and Submission Date. Question The probability density function (pdf) of the normal distribution is given by ππππ (π₯π₯) = 1 β2ππππ 2 exp οΏ½β (π₯π₯ β ππ)2 οΏ½, 2ππ 2 where x is the observed value of a random variable X, Ο is the value of the constant pi (β 3.14159), Β΅ is the mean and Ο2 is the variance of the distribution, and exp() is the exponential function. As an analyst and Python programming specialist, you are asked to construct a program to compute the probability of a normally distributed random variable given the distribution mean and variance. Note: Include your Python program code in the answers and show them in the βConsolasβ or βCourier Newβ fonts (size 12). Make a screenshot of the program output if required. (a) Prepare the programming of the function by importing the βmathβ package into your program which is needed for the square root and the exponential functions. You can also find a much more exact value for Ο in the math package. Refer to the official website of the math package https://docs.python.org/3/library/math.html for more details of the functions. (1 mark) (b) Employ a Python program to ask the user to enter the mean and variance of the distribution. Tell the user that the mean can be any value between minus infinity (ββ) and plus infinity (+β), but the variance must be a value larger than 0. Integrate certain control mechanism to ensure that the variance condition is fulfilled, and the input is numeric. If the user press ENTER without providing any values, the program will automatically set Β΅ to 0 and Ο2 to 1. (15 marks) SINGAPORE UNIVERSITY OF SOCIAL SCIENCES (SUSS) Page 2 of 3 ANL252 Tutor-Marked Assignment (c) Design an input screen for the user to enter the value of X. Tell the user that the value can be any value between minus infinity (ββ) and plus infinity (+β). Integrate certain control mechanism to ensure that the input is numeric. (4 marks) (d) Construct a user-defined function using the formula of the probability density function given above to compute the corresponding probability density fX(x) based on the user inputs in (b) and (c). (15 marks) (e) Use formatted printing to display the result of (d) to the user. (f) The probability of a normally distributed random variable X smaller equal to a value k can be determined by the cumulative distribution function (cdf) which can be approximated by the weighted sum of the density function of X from ββ to k: (10 marks) ππ(ππ β€ ππ) β πΌπΌ[ππππ (ππ) + β― + ππππ (ππ β 2πΌπΌ) + ππππ (ππ β πΌπΌ) + ππππ (ππ)], where Ξ± is the range of each step and a is a number close to ββ. For example, if we choose Ξ± = 0.01, a = -100 and k = 0, then the summation is ππ(ππ β€ 0) β 0.01[ππππ (β100) + β― + ππππ (β0.02) + ππππ (β0.01) + ππππ (0)] The accuracy of the approximation increases with the decrease of the step range Ξ±. That means, the smaller the step width is, the more terms we can put between a and k, and the more accurate is the probability. Design a program to compute P(X β€ k) where k is the value that the user entered in (c). Use the user input in (b) as the values for the parameters Β΅ and Ο2 and display the result to the user by formatted printing. Furthermore, check the results for k = 0, 1.64, and 1.96 with a mean of 0 and variance of 1 as well. (25 marks) (g) Explain your program for the calculation of P(X β€ k) in (f) in less than 200 words. (15 marks) (h) Create a dictionary to store the probabilities of the normal distribution for x = {-5, -4.9, -4.8, β¦, 0, 0.1, 0.2, β¦, 4.8, 4.9, 5} where x are the keys, and the corresponding probabilities are the values of the dictionary. The distribution mean here is 0 and variance is 1. Print all the probabilities (with the corresponding x) of those xβs between -2 and 2 with a step width of 0.5 from the dictionary onto the screen. (15 marks) —- END OF ASSIGNMENT —- SINGAPORE UNIVERSITY OF SOCIAL SCIENCES (SUSS) Page 3 of 3

Do you similar assignment and would want someone to complete it for you? Click on theΒ **ORDER NOW**Β option to get instant services atΒ **essayloop.com**

Do you have a similar assignment and would want someone to complete it for you? Click on the ORDER NOW option to get instant services at essayloop.com. We assure you of a well written and plagiarism free papers delivered within your specified deadline.