12/1/2019 Department of Veterinary and Animal Sciences Advanced - - PDF document

12 1 2019
SMART_READER_LITE
LIVE PREVIEW

12/1/2019 Department of Veterinary and Animal Sciences Advanced - - PDF document

12/1/2019 Department of Veterinary and Animal Sciences Advanced Quantitative Methods in Herd Management The Normal Distribution and Confidence Intervals Leonardo de Knegt Anders Ringgaard Kristensen Department of Veterinary and Animal


slide-1
SLIDE 1

12/1/2019 1

Department of Veterinary and Animal Sciences

Advanced Quantitative Methods in Herd Management The Normal Distribution and Confidence Intervals

Leonardo de Knegt Anders Ringgaard Kristensen

Outline

Probabilities summary Distributions Discrete distributions Continuous distributions Density functions The normal distribution

  • Distribution functions
  • Sampling
  • Hypothesis testing
  • Confidence intervals

Department of Veterinary and Animal Sciences Slide 2

Summary of probabilities

  • Probabilities may be interpreted
  • As frequencies
  • As objective or subjective beliefs in certain events
  • The belief interpretation enables us to represent uncertain

knowledge in a concise way.

Department of Veterinary and Animal Sciences Slide 3

slide-2
SLIDE 2

12/1/2019 2

Distributions

  • In some cases the probability is defined by a certain function

defined over the sample space.

  • In those cases, we say that the outcome is drawn from a

standard distribution.

  • There exist standard distributions for many natural

phenomena.

  • If the sample space is a countable set, we denote the

corresponding distribution as discrete.

Department of Veterinary and Animal Sciences Slide 4

Discrete distributions

If X is the random variable representing the outcome, the expected value of a discrete distribution is defined as 𝐹 𝑌 = 1 ∗ 1 6 + 2 ∗ 1 6 + 3 ∗ 1 6 + 4 ∗ 1 6 + 5 ∗ 1 6 + 6 ∗ 1 6 = 3.5 The variance is defined as 𝑊𝑏𝑠 𝑌 = 1+ 2 + 3 + 4 + 5+ 6 6 − 3.5 2 = 2.93

Department of Veterinary and Animal Sciences Slide 5

Continuous distributions

  • In some cases, the sample space S of a distribution is not

countable.

  • If, furthermore, S is an interval on R, the random variable X

taking values in S is said to have a continuous distribution.

  • For any x  S, we have P(X = x) = 0.
  • Thus, no probability function exists for a continuous

distribution can’t be expressed in tabular form.

  • Instead, the distribution is characterized by a density

function f(x).

Department of Veterinary and Animal Sciences Slide 6

slide-3
SLIDE 3

12/1/2019 3

Density functions

  • The density function f has the following properties (for a, b  R and a  b)
  • Thus, for a continuous distribution, f can only be interpreted as a

probability when integrated over an interval.

Department of Veterinary and Animal Sciences Slide 7

Continuous distributions

For a continuous distribution, the expected value E(X) is defined as And the variance is (just like the discrete case)

Department of Veterinary and Animal Sciences Slide 8

The normal distribution

  • If S = R, and the random variable X has a normal distribution on S, then

the density function is

  • The expected value and the variance simply turn out to be E(X) = , and

Var(X) = 2

  • We say that X is N(, 2), or X ~ N(, 2)

Department of Veterinary and Animal Sciences Slide 9

slide-4
SLIDE 4

12/1/2019 4

The normal distribution

  • The normal distribution may be used to represent almost all kinds of

random outcome on the continuous scale in the real world.

  • Exceptions: phenomena that are bounded in some sense (e.g. the

waiting time to be served in a queue cannot be negative)

  • It can be showed (central limit theorems) that if X1, X2, …, Xn are

random variables of (more or less) any kind, then the sum Yn = X1 + X2 + …+ Xn is normally distributed for n sufficiently large.

  • The normal distribution is the cornerstone among statistical

distributions.

Department of Veterinary and Animal Sciences Slide 10

Normal distributions

Three normal distributions with mean m and standard deviation s

Three normal distributions

0,1 0,2 0,3 0,4 0,5

  • 10
  • 5

5 10 x f(x) m=0, s=3 m=-5, s=1 m=0, s=1

Department of Veterinary and Animal Sciences Slide 11

Normal distributions

  • The normal distribution with  = 0, and  = 1 is called the

standard normal distribution.

  • A random variable being standard normally distributed is
  • ften denoted as Z
  • The density function of the standard normal distribution is
  • ften denoted as  (phi). It follows that

Department of Veterinary and Animal Sciences Slide 12

slide-5
SLIDE 5

12/1/2019 5

Normal distributions: operation properties

  • Let X1 ~ N(1, 1

2), X2 ~ N(2, 2 2), and X1 and X2 are independent.

  • Define Y1 = X1 + X2 and Y2 = X1 − X2. Then
  • Y1 ~ N(1 + 2, 1

2 + 2 2)

  • Y2 ~ N(1 − 2, 1

2 + 2 2)

  • Let a and b be arbitrary real numbers, and let X~ N(, 2).
  • Define Y =aX + b. Then, Y ~ N(a + b, a22)

Department of Veterinary and Animal Sciences Slide 13

Normal distributions

  • From the previous slide it follows in particular, that if X~ N(, 2), then
  • So, if f is the density function of X ~ N(, 2), then

Thus, we can calculate the value of any density function for a normal distribution from the density distribution of the standard normal distribution.

Department of Veterinary and Animal Sciences Slide 14

Distribution functions

  • We have so far defined distributions by:
  • probability functions (discrete distributions)
  • density functions (continuous distributions).
  • We might just as well have used the distribution function F, which is

defined in the same way for both classes of distributions:

  • F(x) = P(X  x)
  • F(x) is called the distribution function, or the Cumulative Distribution

Function (CDF)

Department of Veterinary and Animal Sciences Slide 15

slide-6
SLIDE 6

12/1/2019 6

Even though the definition is the same, the value of the distribution function is calculated in different ways for the two classes of distributions.

  • For discrete distributions
  • For continuous distributions

Department of Veterinary and Animal Sciences Slide 16

Distribution functions

Recap:

  • F(X): Cumulative Distribution Function of X
  • F(x) = P(X ≤ x)
  • probability that the random variable X takes a value

smaller than some specific value x

  • f(x): Probability Density Function of x
  • Probability that the random variable x takes a value within

an interval

Department of Veterinary and Animal Sciences Slide 17

Distribution functions

  • From the formula above, it follows directly that for a continuous

distribution, F’(x) = f(x)

  • The distribution function of the standard normal distribution is
  • ften denoted as , and naturally ’(z) = (z) . No closed form

(formula) exists for , it must be looked up in tables.

Department of Veterinary and Animal Sciences Slide 18

Distribution functions

slide-7
SLIDE 7

12/1/2019 7

Any distribution function F has the following two properties:

  • F(x)  0 for x  -
  • F(x)  1 for x  

Department of Veterinary and Animal Sciences Slide 19

Distribution functions

Three normal distributions 0,1 0,2 0,3 0,4 0,5

  • 10
  • 5

5 10 x f(x) m=0, s=3 m=-5, s=1 m=0, s=1 Three normal distributions 0,2 0,4 0,6 0,8 1

  • 10
  • 5

5 10 x f(x) m=0, s=3 m=-5, s=1 m=0, s=1

Density function Distribution function Assume that X1, X2, …, Xn are sampled independently from the same distribution having the known expectation  and the known standard deviation  Then the mean of the sample has the expected value  and the standard deviation In particular, if the Xi’s are N(, 2) then the sample mean is N(, 2/n)

Department of Veterinary and Animal Sciences Slide 20

Sampling form a distribution

  • Assume that X1, X2, …, Xn are sampled independently from the same

normal distribution N(, 2) where  is unknown and  is known.

  • For some reason we expect (hope) that  has a certain value 0, and we

would therefore like to test the following hypothesis: H0:  = 0

  • How can we do that?

Well, we know that the sample mean is N(, 2/n)

Department of Veterinary and Animal Sciences Slide 21

Sampling from a Normal Distribution

slide-8
SLIDE 8

12/1/2019 8

A normal distribution with standard deviation 3 0,1 0,2

  • 1
  • 9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10

x f(x) m=0, s=3 A normal distribution with standard deviation 3 0,2 0,4 0,6 0,8 1

  • 1
  • 9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10

x f(x) m=0, s=3

  • Observations close to the mean are far more likely than distant
  • bservations.
  • From the distribution function we can calculate the likelihood that an
  • bservation falls within the interval  ± 

Hypothesis testing in normal distributions

  • For the interval  ±  , where = 0,  =1

𝑎 = 𝑌 − 𝜈 𝜏 𝑔(𝑦) = ฀(

)

For a standard normal distribution (z): …which that translates to our density function: Phi is the area under the curve! P(𝜈 −   𝑌 𝜈 + ) = (𝜈 + ) - (𝜈 − )

0  F(x) = P(X ≤ x) Always gives the area to the left

Hypothesis testing in normal distributions

P(−1  𝑌 1) = (1) - (−1) Look up at the z table! P(𝜈 −   𝑌 𝜈 + ) = (𝜈 + ) - (𝜈 − ) P(0 − 1  𝑌 0 + 1) = (0 + 1) − (0 − 1)

Hypothesis testing in normal distributions

slide-9
SLIDE 9

12/1/2019 9

Hypothesis testing in normal distributions

P(−1  𝑌  1) = (1) - (−1) P(𝜈 −   𝑌 𝜈 + ) = (𝜈 + ) - (𝜈 − ) P(0 − 1  𝑌 0 + 1) = (0 + 1) − (0 − 1) P(−1  𝑌  1) = 0.84 − 0.16 = 0.68 Rule of thumb In a normal distribution:

  • 68% of the observations

fall within ±1

  • 95% of observations fall

within ±2 P(−2  𝑌  2) = 0.98 − 0.02 = 0.96 Actually, 1.96

Hypothesis testing in normal distributions

  • We can test our hypothesis H0 for instance by calculating a confidence

interval for the mean.

  • A 95% confidence interval for the sample mean (distributed as N(, 2/n))

under H0 is calculated as

  • If the sample mean is included in the interval, we accept H0, otherwise we

reject.

  • If neither  nor  are known, the sample mean becomes student-t

distributed (with n-1 degrees of freedom) instead. Then the confidence interval becomes wider as consequence of the uncertainty on . For large n the student-t distribution converges towards a standard normal distribution.

Department of Veterinary and Animal Sciences Slide 27

Hypothesis testing in normal distributions