+ All Categories
Home > Documents > Screen ns Lab 5

Screen ns Lab 5

Date post: 02-Apr-2018
Category:
Upload: parsa-far
View: 214 times
Download: 0 times
Share this document with a friend
21
Lab 5: Probability density and cumulative distri- butions 1 In trod ucti on The purpose of this lab is to become familiar with the concepts of probability density, cumulative distribution, mean, and median. In particular, we will be studying the empirical data from some Bernoulli trials, which should t a binomial distribution. We will plot the probability density and cumulative distribution as bar graphs, and then compute the mean and median from these bar graphs. The mean ¯ x of a random variable whose possible values x i have probabilities p(x i ) is dened by ¯ x = i x i  p(x i ). The median m of an (unordered) list of numbers is the middle number after ordering. For instance, if the ordered list is 1, 2, 2, 2, 3, 3, 4 then the middle number (media n) is 2. Thus, the median of the related random variable is the rst x for which the cumulative distribution function exceeds (or is equal to) 0 .5. Convin ce your sel f that this is so! (In cases of an even number of data points the convention is to use the average of the middle two, but this does not occur in this lab.) [ Introduction Problem Set 1 Problem Set 2 Problem Set 3 Problem Set 4 Problem Set 5 Previous Page Next Page Exit ]
Transcript
Page 1: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 1/21

Lab 5: Probability density and cumulative distri-butions

1 Introduction

The purpose of this lab is to become familiar with the concepts of 

• probability density,

• cumulative distribution,

• mean, and

• median.

In particular, we will be studying the empirical data from some Bernoulli trials, whichshould fit a binomial distribution. We will plot the probability density and cumulativedistribution as bar graphs, and then compute the mean and median from these bargraphs.

The mean x̄ of a random variable whose possible values xi have probabilities p(xi) isdefined by

x̄ =i

xi p(xi).

The median m of an (unordered) list of numbers is the middle number after ordering.For instance, if the ordered list is 1, 2, 2, 2, 3, 3, 4 then the middle number (median) is 2.Thus, the median of the related random variable is the first x for which the cumulativedistribution function exceeds (or is equal to) 0.5. Convince yourself that this is so!(In cases of an even number of data points the convention is to use the average of themiddle two, but this does not occur in this lab.)

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit]

Page 2: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 2/21

2 Problems

2.1 Problem Set 1

Given below is the distribution of number of heads obtained by a group of people inan experiment in which each person tossed a fair coin ten times.Let:x = number of heads obtained out of ten tosses.N (x)=number of people who got x heads.

• Use the above data to plot a bar graph of  p(x), i.e., the empirical probabilitydistribution of obtaining x heads in 10 tosses. Center the bars at the integers. (Seenote at the bottom for plotting.)

• Plot the cumulative distribution (of obtaining up to x heads) for the empirical data.Technically this should be a step function, but step functions are difficult to displayusing Mathsheet, so we suggest using a bar graph.

• Use the spreadsheet to calculate the expected number of heads based on the sameempirical data.

• Find the median number of heads of the empirical data.

• Finally, plot a bar graph of the theoretical probability distribution in the same way.

• Submit a graph of these three bar graphs and write the values you found for themean and the median of the empirical data on the bottom of the page. Also, pleaseexplain how you computed the median.

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit ]

Page 3: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 3/21

x N (x)

0 0

1 1

2 8

3 11

4 20

5 36

6 25

7 13

8 8

9 2

10 0

Table 1 Problem Set 1: Of 124 peopleN (x) tossed x heads

Note: It is somewhat tricky to display all three of these bar graphs without having

them cover eachother. One possible solution is to plot the cumulative distribution first(filled) with the empirical probability distribution filled on top. Finally, the theoreticalprobability distribution can be plotted over everything, but with the fill setting off sothat the other graphs show through.

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit ]

Page 4: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 4/21

2.1.1 Solution to Problem Set 1

0.2

0.4

0.5

0.6

0.8

1

2 4 5 6 8 10

Figure 1 Solution for problem set 1. The median number of heads is 5,

(first x for which the cumulative distribution function exceeds 0.5) and theexpected number of heads (also called mean number of heads) is calculatedby the spreadsheet as x̄ = 5.1.

Here’s how the data could be organized: Column 1 contains the number x of headsfrom 1 to 10. Column 2 contains the number of people who got x heads. Column 3contains the theoretically expected number of people who got x heads. Column 4 totals

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit ]

Page 5: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 5/21

up the size of the group of people. (There were 124 people in all). The numbers in

column 5 are then the fraction N (x)124 of the group that got a given number of heads.

This is the probability p(x) of getting x heads. Column 6 computes the cumulativefunction F (x). Column 7 computes xp(x) and column 8 then sums these up to get themean value of  x for the probability density.We see that the mean value is x̄ = 5.1.

Figure 1 then shows the graphs of p(x) and F (x) and the theoretical value on the samegraph.From this graph, we can read off the median value. We locate the x at which thecumulative distribution function (blue curve) exceeds the value 0.5 for the first time.This is at m = 5.

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit ]

Page 6: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 6/21

2.2 Problem Set 2

Given below is the distribution of number of heads obtained by a group of people inan experiment in which each person tossed a fair coin ten times.Let:x = number of heads obtained out of ten tosses.

N (x)=number of people who got x heads.

x N (x)

0 0

1 1

2 3

3 134 16

5 14

6 20

7 9

8 5

9 1

10 0

Table 2 Problem Set 2: Of 82 peopleN (x) tossed x heads

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit ]

Page 7: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 7/21

• Use the above data to plot a bar graph of  p(x), i.e., the empirical probabilitydistribution of obtaining x heads in 10 tosses. Center the bars at the integers. (Seenote at the bottom for plotting.)

• Plot the cumulative distribution (of obtaining up to x heads) for the empirical data.Technically this should be a step function, but step functions are difficult to display

using Mathsheet, so we suggest using a bar graph.• Use the spreadsheet to calculate the expected number of heads based on the same

empirical data.

• Find the median number of heads of the empirical data.

• Finally, plot a bar graph of the theoretical probability distribution in the same way.

• Submit a graph of these three bar graphs and write the values you found for themean and the median of the empirical data on the bottom of the page. Also, pleaseexplain how you computed the median.

Note: It is somewhat tricky to display all three of these bar graphs without havingthem cover eachother. One possible solution is to plot the cumulative distribution first(filled) with the empirical probability distribution filled on top. Finally, the theoretical

probability distribution can be plotted over everything, but with the fill setting off sothat the other graphs show through.

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit ]

Page 8: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 8/21

2.2.1 Solution to Problem Set 2

0.2

0.4

0.5

0.6

0.8

1

2 4 5 6 8 10

Figure 2 Solution for problem set 2. The median number of heads is 5,

(first x for which the cumulative distribution function exceeds 0.5) and theexpected number of heads (also called mean number of heads) is calculatedby the spreadsheet as x̄ = 5.02.

Here’s how the data could be organized: Column 1 contains the number x of headsfrom 1 to 10. Column 2 contains the number of people who got x heads. Column 3contains the theoretically expected number of people who got x heads. Column 4

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit ]

Page 9: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 9/21

totals up the size of the group of people. (There were 82 people in all). The numbers

in column 5 are then the fraction N (x)82 of the group that got a given number of heads.

This is the probability p(x) of getting x heads. Column 6 computes the cumulativefunction F (x). Column 7 computes xp(x) and column 8 then sums these up to get themean value of  x for the probability density.We see that the mean value is x̄ = 5.02.

Figure 2 then shows the graphs of p(x) and F (x) and the theoretical value on the samegraph.From this graph, we can read off the median value. We locate the x at which thecumulative distribution function (blue curve) exceeds the value 0.5 for the first time.This is at m = 5.

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit ]

Page 10: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 10/21

2.3 Problem Set 3

Given below is the distribution of number of heads obtained by a group of people inan experiment in which each person tossed a fair coin ten times.Let:x = number of heads obtained out of ten tosses.

N (x)=number of people who got x heads.

x N (x)

0 0

1 1

2 9

3 174 25

5 37

6 20

7 14

8 6

9 1

10 0

Table 3 Problem Set 3: Of 130 peopleN (x) tossed x heads

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit ]

Page 11: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 11/21

• Use the above data to plot a bar graph of  p(x), i.e., the empirical probabilitydistribution of obtaining x heads in 10 tosses. Center the bars at the integers. (Seenote at the bottom for plotting.)

• Plot the cumulative distribution (of obtaining up to x heads) for the empirical data.Technically this should be a step function, but step functions are difficult to display

using Mathsheet, so we suggest using a bar graph.• Use the spreadsheet to calculate the expected number of heads based on the same

empirical data.

• Find the median number of heads of the empirical data.

• Finally, plot a bar graph of the theoretical probability distribution in the same way.

• Submit a graph of these three bar graphs and write the values you found for themean and the median of the empirical data on the bottom of the page. Also, pleaseexplain how you computed the median.

Note: It is somewhat tricky to display all three of these bar graphs without havingthem cover eachother. One possible solution is to plot the cumulative distribution first(filled) with the empirical probability distribution filled on top. Finally, the theoretical

probability distribution can be plotted over everything, but with the fill setting off sothat the other graphs show through.

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit ]

Page 12: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 12/21

2.3.1 Solution to Problem Set 3

0.2

0.4

0.5

0.6

0.8

1

2 4 5 6 8 10

Figure 3 Solution for problem set 3. The median number of heads is 5,

(first x for which the cumulative distribution function exceeds 0.5) and theexpected number of heads (also called mean number of heads) is calculatedby the spreadsheet as x̄ = 4.85.

Here’s how the data could be organized: Column 1 contains the number x of headsfrom 1 to 10. Column 2 contains the number of people who got x heads. Column 3contains the theoretically expected number of people who got x heads. Column 4 totals

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit ]

Page 13: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 13/21

up the size of the group of people. (There were 130 people in all). The numbers in

column 5 are then the fraction N (x)130 of the group that got a given number of heads.

This is the probability p(x) of getting x heads. Column 6 computes the cumulativefunction F (x). Column 7 computes xp(x) and column 8 then sums these up to get themean value of  x for the probability density.We see that the mean value is x̄ = 4.85.

Figure 3 then shows the graphs of p(x) and F (x) and the theoretical value on the samegraph.From this graph, we can read off the median value. We locate the x at which thecumulative distribution function (blue curve) exceeds the value 0.5 for the first time.This is at m = 5.

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit ]

2 4 P bl S t 4 I d i

Page 14: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 14/21

2.4 Problem Set 4

Given below is the distribution of number of heads obtained by a group of people inan experiment in which each person tossed a fair coin ten times.Let:x = number of heads obtained out of ten tosses.N 

(x

)=number of people who gotx

heads.

x N (x)

0 0

1 0

2 1

3 8

4 35

5 17

6 20

7 14

8 3

9 1

10 0

Table 4 Problem Set 4: Of 99 peopleN (x) tossed x heads

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit ]

U th b d t t l t b h f ( ) i th i i l b bilit I d i

Page 15: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 15/21

• Use the above data to plot a bar graph of  p(x), i.e., the empirical probabilitydistribution of obtaining x heads in 10 tosses. Center the bars at the integers. (Seenote at the bottom for plotting.)

• Plot the cumulative distribution (of obtaining up to x heads) for the empirical data.Technically this should be a step function, but step functions are difficult to displayusing Mathsheet, so we suggest using a bar graph.

• Use the spreadsheet to calculate the expected number of heads based on the sameempirical data.

• Find the median number of heads of the empirical data.

• Finally, plot a bar graph of the theoretical probability distribution in the same way.

• Submit a graph of these three bar graphs and write the values you found for themean and the median of the empirical data on the bottom of the page. Also, pleaseexplain how you computed the median.

Note: It is somewhat tricky to display all three of these bar graphs without havingthem cover eachother. One possible solution is to plot the cumulative distribution first(filled) with the empirical probability distribution filled on top. Finally, the theoretical

probability distribution can be plotted over everything, but with the fill setting off sothat the other graphs show through.

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit ]

2 4 1 S l ti t P bl S t 4 I t d ti

Page 16: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 16/21

2.4.1 Solution to Problem Set 4

0.2

0.4

0.5

0.6

0.8

1

2 4 5 6 8 10

Figure 4 Solution for problem set 4. The median number of heads is 5,

(first x for which the cumulative distribution function exceeds 0.5) and theexpected number of heads (also called mean number of heads) is calculatedby the spreadsheet as x̄ = 5.07.

Here’s how the data could be organized: Column 1 contains the number x of headsfrom 1 to 10. Column 2 contains the number of people who got x heads. Column 3contains the theoretically expected number of people who got x heads. Column 4

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit ]

totals up the size of the group of people (There were 99 people in all) The numbers Int od ction

Page 17: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 17/21

totals up the size of the group of people. (There were 99 people in all). The numbers

in column 5 are then the fraction N (x)99 of the group that got a given number of heads.

This is the probability p(x) of getting x heads. Column 6 computes the cumulativefunction F (x). Column 7 computes xp(x) and column 8 then sums these up to get themean value of  x for the probability density.We see that the mean value is x̄ = 5.07.

Figure 4 then shows the graphs of p(x) and F (x) and the theoretical value on the samegraph.From this graph, we can read off the median value. We locate the x at which thecumulative distribution function (blue curve) exceeds the value 0.5 for the first time.This is at m = 5.

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit]

2 5 Problem Set 5 Introduction

Page 18: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 18/21

2.5 Problem Set 5

Given below is the distribution of number of heads obtained by a group of people inan experiment in which each person tossed a fair coin ten times.Let:x = number of heads obtained out of ten tosses.N (x)=number of people who got x heads.

x N (x)

0 0

1 2

2 1

3 17

4 15

5 31

6 28

7 10

8 2

9 1

10 0

Table 5 Problem Set 5: Of 107 peopleN (x) tossed x heads

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit]

• Use the above data to plot a bar graph of p(x) i e the empirical probability Introduction

Page 19: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 19/21

• Use the above data to plot a bar graph of  p(x), i.e., the empirical probabilitydistribution of obtaining x heads in 10 tosses. Center the bars at the integers. (Seenote at the bottom for plotting.)

• Plot the cumulative distribution (of obtaining up to x heads) for the empirical data.Technically this should be a step function, but step functions are difficult to displayusing Mathsheet, so we suggest using a bar graph.

• Use the spreadsheet to calculate the expected number of heads based on the sameempirical data.

• Find the median number of heads of the empirical data.

• Finally, plot a bar graph of the theoretical probability distribution in the same way.

• Submit a graph of these three bar graphs and write the values you found for themean and the median of the empirical data on the bottom of the page. Also, pleaseexplain how you computed the median.

Note: It is somewhat tricky to display all three of these bar graphs without havingthem cover eachother. One possible solution is to plot the cumulative distribution first(filled) with the empirical probability distribution filled on top. Finally, the theoretical

probability distribution can be plotted over everything, but with the fill setting off sothat the other graphs show through.

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit]

2 5 1 Solution to Problem Set 5 Introduction

Page 20: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 20/21

2.5.1 Solution to Problem Set 5

0.2

0.4

0.5

0.6

0.8

1

2 4 5 6 8 10

Figure 5 Solution for problem set 5. The median number of heads is 5,

(first x for which the cumulative distribution function exceeds 0.5) and theexpected number of heads (also called mean number of heads) is calculatedby the spreadsheet as x̄ = 4.98.

Here’s how the data could be organized: Column 1 contains the number x of headsfrom 1 to 10. Column 2 contains the number of people who got x heads. Column 3contains the theoretically expected number of people who got x heads. Column 4 totals

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit]

up the size of the group of people. (There were 107 people in all). The numbers in Introduction

Page 21: Screen ns Lab 5

7/27/2019 Screen ns Lab 5

http://slidepdf.com/reader/full/screen-ns-lab-5 21/21

up the size of the group of people. (There were 107 people in all). The numbers in

column 5 are then the fraction N (x)107 of the group that got a given number of heads.

This is the probability p(x) of getting x heads. Column 6 computes the cumulativefunction F (x). Column 7 computes xp(x) and column 8 then sums these up to get themean value of  x for the probability density.We see that the mean value is x̄ = 4.98.

Figure 5 then shows the graphs of p(x) and F (x) and the theoretical value on the samegraph.From this graph, we can read off the median value. We locate the x at which thecumulative distribution function (blue curve) exceeds the value 0.5 for the first time.This is at m = 5.

[

Introduction

ProblemSet 1

ProblemSet 2

ProblemSet 3

ProblemSet 4

ProblemSet 5

Previous Page

Next Page

Exit]


Recommended