Mathematics  >  QUESTIONS & ANSWERS  >  The probability density function (pdf) of the normal distribution is given by (All)

The probability density function (pdf) of the normal distribution is given by

Document Content and Description Below

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 v ... alue 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) (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. (10 marks) (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: ??(?? ≤ ??) ≈ ??[????(??) + ⋯ + ????(?? − 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) [Show More]

Last updated: 3 years ago

Preview 1 out of 8 pages

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)
Preview image of The probability density function (pdf) of the normal distribution is given by document

Buy this document to get the full access instantly

Instant Download Access after purchase

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Reviews( 0 )

$8.00

Buy Now

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Instant download

Can't find what you want? Try our AI powered Search

105
0

Document information


Connected school, study & course


About the document


Uploaded On

Aug 05, 2021

Number of pages

8

Written in

All

Seller


Profile illustration for Cheryshev
Cheryshev

Member since 4 years

102 Documents Sold

Reviews Received
6
4
1
0
1
Additional information

This document has been written for:

Uploaded

Aug 05, 2021

Downloads

 0

Views

 105

Document Keyword Tags


$8.00
What is Scholarfriends

Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.

We are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Scholarfriends · High quality services·