R studio
#Exercise : Calculate the following probabilities :
#1. Probability that a normal random variable with mean 22 and
variance 25
#(i)lies between 16.2 and 27.5
#(ii) is greater than 29
#(iii) is less than 17
#(iv)is less than 15 or greater than 25
#2.Probability that in 60 tosses of a fair coin the head comes
up
#(i) 20,25 or 30 times
#(ii) less than 20 times
#(iii) between 20 and 30 times
#3.A random variable X has Poisson distribution with mean 7. Find
the probability that
# (i) X is less than or equal to 5:
#less than 4:
#(ii) X is greater than 10
# (iii)X is between 4 and 16
#Quantiles
# The following examples show how obtain the quantiles
# of some common distributions for the values (vector) given:
#Normal(0,1) Distribution :
y <- c(.01,.05,.1,.2,.5,.8,.95,0.975, .99)
#BinomialDistribution size = 30, prob = 0.2:
y <- c(.01,.05,.1,.2,.5,.8,.95,.99)
#Poisson($\lambda$) Distribution with mean (lambda) = 6:
y <- c(.01,.05,.1,.2,.5,.8,.95,.99)
#Random Variable generation
# Generate 10 random numbers from the normal (0,1) distribution
# Generate 10 random numbers from the normal distribution with mean 5 and a standard deviation of 2.5
# Generate 20 random numbers from the binomial with a size of 5
and probability of 20 percent
# Generate 20 random numbers from the poisson with a lambda of
6
# Exercise (Advanced) : Generate 500 samples from Student's $t$
distribution with 5 degrees of freedom and plot the
historgam.
# (Note: $t$ distribution is going to be covered in class). The
corresponding function is rt . hist(rt(500,5),40)
#Density Plots
#Plotting the probability density function (pdf) of a Normal
distribution :
# over the x vector given; and plot it
x <- seq(-4.5,4.5,.1)
#Plotting the probablity mass function for the following 2
variables distributed Binomially with size 30;
# the first one with probability 0.15 and the second with
probability 0.4:
# Split the screen into 2 and generate the two plots on the same
screen
k <- c(1:15)
#================================================================================================
#Using the dataset "USAarrests" available in base R; answer the
questions below.
# This data set contains statistics about violent crime rates by us
state; it is available in base R
#Make a scatterplot of Murder and UrbanPop. Describe the
relationship between these two variables.
# display histograms of Murder and Rape
# Find the mean and standard deviation of both Murder and Rape
# Identify the 27th percentile of the Assault series; the 50th percentile
# # Identify the 27th percentile of the Rape data, the 50th percentile AND the 97the percentile
# display a barchart of the 27th, 50th, and 97th percentiles
# Determine what proportion of the data
# are within one standard deviation of the mean
# Display a histogram of Assault and Rape and identify the mean and the mean +/- one standard deviation
# Provide a title and properly label the x and y axes for all your charts.
#========================================================================================================
# Compare monthly data for the "market" (eg DJI) and for General
Electric for the period 2015-01 till September
# #Rebase both sector series to 100 in 2015-01-01
# How was GE performed relative to the market over the period
examined?
# Do this by rebasing the two series to 100 = 2015-01-01
# add an appropriate legend to the graph
# Color one line purple and the other red
#========================================================================================================
#===============================================================================================
# Display the distribution of the mean of the data for Size,below
(hint: use a for loop)
# this means that we are using the collected sample (shown below)
to simulate the p
# Example Widgets
# Generate a sequence of number from 1 to 20; call it Count
# Generate a sequence of 20 numbers from 200.5 to 355.125; add to
it numbers from a random normal of
# mean 5 and standard deviation 10; call it Size
# first find the mean of Size
# Identify the mean in the histogram of the distribution of the
mean - with a red line; and label the graph properly
#display the generated data for Size in a boxplot
# What is the probability that someone is less than 270 in
size?
#5 What is the probability that a man is greater than 300 in
size?
#6 What is the probaiblity of being between 280 and 300 in
size?
# If being at 20% of the scale is the cutting point for being hefty when it comes to size, what is the "hefty cut-off point"?
# load library e1071; find measures of skewness and kurtosis of the Size variable.
Solution:-
1)
Mean = 22, variance = 25
(i) The probability that mean lies between 16.2 and 27.5 is 0.741.
x1 = 16.2
x2 = 27.5
By applying normal distribution:-
z1 = - 1.16
z2 = 1.10
P( -1.16 < z < 1.10) = P(z > - 1.16) - P(z > 1.10)
P( -1.16 < z < 1.10) = 0.877 - 0.136
P( -1.16 < z < 1.10) = 0.74
(ii) P(x > 29) = 0.081.
x = 29
By applying normal distribution:-
z = 1.40
P(z > 1.40) = 0.081
(iii) P(x < 17) = 0.159
x = 17
By applying normal distribution:-
z = - 1.0
P(z < -1.0) = 0.159
iv) P(15 > x > 25) = 0.355.
x1 = 15
x2 = 25
By applying normal distribution:-
z1 = - 1.40
z2 = 0.60
P( -1.40 > z > 0.60) = P(z < -1.40) + P(z > 0.60)
P( -1.40 > z > 0.60) = 0.081 + 0.274
P( -1.40 > z > 0.60) = 0.355
R studio #Exercise : Calculate the following probabilities : #1. Probability that a normal random variable...
If ? is a random variable that follows a normal distribution with a mean of 20 and standard deviation 3.2, what value of ? represents the 50th percentile?
9] Suppose X is Normal random variable with mean 10 and SD 4. What is the probability that X is between 7 and 13? [10] Suppose X is Normal random variable with unknown mean mu and SD 4. For what value of mu, 80th percentile of X will be 23? (11] Lifetime of Carbon 14, X, is modeled by Exponential distribution with mean of 8223.7 years Determine its half-life (50th percentile).
For a Standard Normal random variable Z, calculate the probability P(-0.25 < Z < 0.25). For a Standard Normal random variable Z, calculate the probability P(-0.32 < Z < 0.32). For a Standard Normal random variable Z, calculate the probability P(-0.43 < Z < 0.43). Calculate the z-score of the specific value x = 26 of a Normal random variable X that has mean 20 and standard deviation 4. A Normal random variable X has mean 20 and standard deviation...
A random variable follows the normal probability distribution with a mean of 80 and a standard deviation of 20. Determine the probability for a randomly selected value from this population in parts a through d below. a. is less than 90 b. is less than 65 c. is more than 110 d. is more than 40.
A Normal random variable X has mean 20 and standard deviation 4. Calculate the probability that specific values of X exceed 26. Calculate the 36th percentile of a Standard Normal random variable. A Standard Normal random variable Z falls within an interval of values centered around zero, that is the interval -z to z, with probability 0.6. Calculate the value of z that defines that interval. A truck makes daily round trips between Charlotte and Atlanta. On 30 percent of...
A random variable X has a normal random varia ble with mean of 20 and standard deviation of 2 (a) Find the two values of X that separates the middle 50% of data (or area) of the distribution of X. Keep at least 2 decimal places (b) Compute the probability that the variable is at most 15. Keep at least 4 decimal places (c) Compute the probability that the variable is less than 12 or more than 21 Keep at...
Question 1 (0.5 points) A random variable X follows a normal distribution with mean of 50 and standard deviation of 5. Suppose we take a simple random sample of size 6 from the population above. Can we calculate the probability that the sample mean is between 45 and 60? (You do not need to actually calculate the probability for this question.) Yes, and the calculated probability would be exact. Yes, and the calculated probability would be approximate. No. Question 2...
A continuous random variable X has a normal distribution with mean 169. The probability that X takes a value greater than 180 is 0.17. Use this information and the symmetry of the density function to find the probability that X takes a value less than 158.
Using Excel - normal probabilities Consider the random variable x that follows a normal distribution, with a mean of μ = 54 and a standard deviation of σ = 4. You will select some of your answers to the questions that follow in this sample Excel spreadsheet: A B 1 P(x < 50.5) 2 P(49 < x < 51) In cell B1 of the sample spreadsheet, select the correct Excel formula for computing the probability that x is less than...
A random variable follows the normal probability distribution with a mean of 100 and a standard deviation of 10. Determine the probability for a randomly selected value from this population in parts a through d below. Click here to view page 1 of the standard normal probability table. Click here to view page 2 of the standard normal probability table. a. What is the probability that the value is less than 80? The probability that the value is less than...