Presentation is loading. Please wait.

Presentation is loading. Please wait.

Continuous Random Variables. Probability Density Function When plotted, continuous treated as discrete random variables can be “binned” form “bars” A.

Similar presentations


Presentation on theme: "Continuous Random Variables. Probability Density Function When plotted, continuous treated as discrete random variables can be “binned” form “bars” A."— Presentation transcript:

1 Continuous Random Variables

2 Probability Density Function When plotted, continuous treated as discrete random variables can be “binned” form “bars” A bar represents the # of times that category occurred.

3 Probability Density Function As we increase the number of “bins” the “bars” get thinner and thinner If there are an infinite number of bins the bars get infinitesimally thin:

4 Probability Density Function Technical definition: A random variate X is continuous if: The probability that X lies between a and b p(x): probability density function (pdf) Note: “All space” for us is usually 0 to ∞ or -∞ to ∞ Proper pdfs should be normalized “All space” for an r.v. is it’s domain. Also called its support

5 Probability Density Function Technical definition: A random variate X is continuous if: The probability that X lies between a and b p(x): probability density function (pdf) Note also: The probability of obtaining a particular r.v. is 0 p(x) ≥ 0 The pdf is always greater than or equal to 0

6 Probability Density Function Graphically: p(x)p(x)

7 Cumulative Distribution Function Same as for discrete r.v.s: A function that gives the probability that a random variable is less than or equal to a specified value is a cumulative distribution function (CDF): CDF for discrete r.v.sCDF for continuous r.v.s Basically just replace a sum with an integral. Minimum of support for the pdf. Usually –∞ or 0.

8 Use of the Cumulative Distribution Function Use the CDF to compute the probability that a RV will lay between two specified x-values F(b)F(b) F(a)F(a) ab

9 Cumulative Distribution Function In R we can compute the CDF of any “built in” pdf like this: There are a lot of “built in” distributions in R. We’ll pretty much only care about “built in” stuff.

10 Cumulative Distribution Function For continuous r.v.s: This is NOT TRUE for discrete r.v.s as we learned last chapter!

11 Moments and Expectation Values Same as for discrete r.v.s: Moments are handy numerical values that can systematically help to describe distribution location and shape properties. m th -order moments are found by taking the expectation value of an RV raised to the m th -power (again, just replacing the sum with an integral): Moments for discrete r.v.sMoments for continuous r.v.s Again, the support of r.v. x

12 Moments and Expectation Values 1 st -order moment for X, i.e. the expectation value of X: mean 1 st -order moment for a parameter g(X) on X: expectation value of parameter g location descriptor

13 Moments and Expectation Values Important 2 nd -order moments: Second order central moment. It can be shown that Population standard deviation spread descriptor

14 Moments and Expectation Values Review from last chapter: Higher-order moments measure other distribution shape properties: 3 rd order: “skewness” 4 th order: “kurtosis” (pointy-ness/flat-ness) leptokurtic platykurtic no skew left skew right skew

15 Example: Moments and Expectation Values Say you have data distributed according to the pdf: Give an expression for the variance of this distribution. In other words, evaluate:

16 Example: Moments and Expectation Values Since we can use technology, lets try to leverage Maple: E[X2]E[X2] E[X]E[X]

17 Example: Moments and Expectation Values Here is what the same calculations would look like in Mathematica: E[X2]E[X2] E[X]E[X] Handy palette can be found at:

18 Example: Moments and Expectation Values Hey, we can even use the interwebs: Wolfram Alpha: http://www.wolframalpha.com/ E[X2]E[X2]

19 Example: Moments and Expectation Values Hey, we can even use the interwebs –OR–: Wolfram Programming Lab!!: https://lab.open.wolframcloud.com/objects/wpl/GetStarted.nb E[X2]E[X2] E[X]E[X] This is old text-input based Mathematica but is VERY POWERFUL. Definitely worth learning, especially because it’s FREE! The Help is great and easy to use!!!!

20 Example: Moments and Expectation Values Hey, we can even use the interwebs –OR–: Wolfram Programming Lab!!: https://lab.open.wolframcloud.com/objects/wpl/GetStarted.nb Type in search terms

21 Example: Moments and Expectation Values Hey, we can even use the interwebs –OR–: Wolfram Programming Lab!!: https://lab.open.wolframcloud.com/objects/wpl/GetStarted.nb

22 Example: Moments and Expectation Values Hey, we can even use the interwebs –OR–: Wolfram Programming Lab!!: https://lab.open.wolframcloud.com/objects/wpl/GetStarted.nb Examples you can try out, click on, cut and paste!!!!

23 Example: Moments and Expectation Values Say you have data distributed according to the pdf: Give an expression for the variance of this distribution. In other words, evaluate:

24 Uniform Distribution Uniform PDF: Same “likelihood” for all x a left bound b right bound Parameters:

25 Mean: Variance: Uniform Distribution

26 Mean: Variance:

27 Uniform Distribution Cumulative distribution function (CDF): punif(q = x, min = a, max = b)

28 Uniform Distribution Use the CDF to compute probabilities: BA F(B)F(B)F(A)F(A) F(B) - F(A)

29 Normal Distribution Normal PDF: The “bell cure”. Also called Gaussian dist.  mean  standard deviation Parameters:

30 Mean:  X  Variance:   X   Normal Distribution

31 Mean:  X  Variance:   X  

32 Normal Distribution Cumulative distribution function (CDF): pnorm(q=x, mean=mu, sd=sigma)

33 Normal Distribution Use the CDF to compute probabilities:

34 Normal Distribution Points of interest for the Normal distribution: If X ~ N( ,  ) we can “standardize” (transform) to the z- scale: Standard normal distribution ~ 68% ± 1  ~ 95% ± 2  ~ 99% ± 3  Handy equation

35 Other Distributions We’ll Encounter Student-t: Like Normal distribution but fatter tails df : degrees of freedom Parameters: dt, qt, pt, rt Chi-squared (  2 ): Handy especially for comparing raw set of counts df : degrees of freedom Parameters: dchisq, qchisq, pchisq, rchisq

36 Other Distributions We’ll Encounter F : Handy especially for comparing average outcomes in three or more experiments. df1 : degrees of freedom 1 df2 : degrees of freedom 2 Parameters: df, qf, pf, rf

37 Example: quantiles/percentiles A sample of methamphetamine in blood certified reference material (CRM) is obtained as a standard for calibration of methodology in a tox lab. The concentration of the CRM is certified to follow a normal distribution with mean concentration of 50 ng/mL and standard deviation of 10 ng/mL. What should 90% of samples taken from the CRM have a concentration less than or equal to?

38 Example: quantiles/percentiles Another way to phrase: What measured sample concentration (quantile) should correspond to the 90 th percentile with respect to the CRM? ? 0.9

39 Example: quantiles/percentiles Another way to phrase: What measured sample concentration (quantile) should correspond to the 90 th percentile with respect to the CRM?

40 Example: quantiles/percentiles What is the probability of that the CRM’s concentration will be measured to be between 30 ng/mL and 70 ng/mL? 30 ng/mL 70 ng/mL What would the code look like if we wanted Pr(X > 70ng/mL)?


Download ppt "Continuous Random Variables. Probability Density Function When plotted, continuous treated as discrete random variables can be “binned” form “bars” A."

Similar presentations


Ads by Google