continuous random variables. probability density function when plotted, discrete random variables...
TRANSCRIPT
Continuous Random Variables
Continuous Random Variables
Probability Density Function• When plotted, discrete random variables (categories)
form “bars”• A bar represents the # of times that category occurred.
Probability Density Function• As more and more different categories occur the “bars”
get thinner and thinner• If there are an infinite number of categories, the bars are
infinitesimally wide
Probability density function
Uniform distribution
Numerical Integration in R
• The integrate() function is used to numerically integrate functions in R.
Example
Numerical Integration in R
• The integrate() function is used to numerically integrate functions in R.
The cumulative distribution function
Computing probabilities using the cdf
Fig. 4-8, p. 138
F(b) F(a)
F(b) - F(a)
Example
Percentiles of a continuous distribution
Fig. 4-10, p. 139
Quantiles in RIn R, all of the built in distributions have a built in function called the quantile function which calculates percentiles. The quantile function always begins with the letter q. So for instance:
Suppose that Z has a standard normal distribution(to be introduced soon) and we wish to determine the 74th percentile of Z, i.e. the value pp such that P(Z < pp) = .74. In R we just use the qnorm() function as follows:
So P(Z<.6433454) ~ .74 To verify in R:
Mean of a continuous random variable
Expected value of a function of a rv
Variance of a continuous rv
Example
• Compute the mean of this rv• Compute the standard deviation of this rv
Example• Compute the mean of this rv
Example• Compute the standard deviation of this rv