Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 4: Numeric integration (challenging) Recall from your statistics or econometrics class that the probability density function (pdf) of a normal distribution with mean u

image text in transcribedimage text in transcribed

Exercise 4: Numeric integration (challenging) Recall from your statistics or econometrics class that the probability density function (pdf) of a normal distribution with mean u and variance o is given by f(x) = - The corresponding cumulative distribution function (cdf) is Fax) = Lswds= La parece en dy FG) = dy = e 262 dy. J- 2102 Unfortunately, the cdf F(x) does not have a closed-form expression; we cannot compute this integral by hand. Instead, we use a technique called numeric integration (i.e., a computer) to calculate the value of the cdf at a given point. One simple but reasonably accurate numeric integration technique is the trapezoid rule, which is taught in every introductory calculus course. The trapezoid rule approximates the area under a curve g(x) with the area of N trapezoids of equal width. Formally, N 1 [ f(x)dx = { }(f(a+k4x) + f(a+(k+ 1)x))^x where Ax = bna In this exercise, your task is to calculate the value of the cdf of the standard normal distribution (i.e., u = 0 and o2 = 1) at x = 1.96. We will do it two ways. First on our own (to practice some list comprehensions) and then, the easy way, using the norm function from scipy. Edit Attachments 1. Write your own code. Your goal is to compute the summation that approximates the integral. Use three list comprehensions. . First, create and store the points ( a + kAx ) at which the pdf is calculated, . Second, create and store the values (f(a + kAx)) of the pdf at each of those points, and Third, create and store the areas (0.5(8[k] + f[k + 1])Ax ) of each trapezoid. Fourth, sum up your trapazoids. Use a = -10, b = 1.96, and N = 10.000. Print the resulting value of the cdf. Edit Attachments 2. Use the function norm.cdf() from scipy.stats and print the result. Scipy is a package of functions useful in mathematics and engineering. To use this function, you will need to import it first with the following code: from scipy.stats import norm You might use ? or Google to learn more about norm.cdf)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Power Bi And Azure Integrating Cloud Analytics For Scalable Solutions

Authors: Kiet Huynh

1st Edition

B0CMHKB85L, 979-8868959943

More Books

Students also viewed these Databases questions

Question

Describe a persuasive message.

Answered: 1 week ago

Question

Identify and use the five steps for conducting research.

Answered: 1 week ago

Question

List the goals of a persuasive message.

Answered: 1 week ago