# Data Science with R

Discussion in 'General Discussions' started by Indu Voleti, Nov 24, 2019.

1. ### Indu Voleti Member

Joined:
Sep 8, 2019
Messages:
2
0
# For a given Mean 494 and standard deviation = 100
# 1. What is the probability that a randomly selected score
# is between 600 and its mean.
# 2. What is the probability of obtaining a score more than 700.
# 3. Score that is less than 550.
# 4. Score between 300 and 600.
pnorm(600,494,100)-pnorm(494,494,100)
#OUTPUT:
# > pnorm(600,494,100)-pnorm(494,494,100)
# [1] 0.3554277
1-pnorm(700,494,100)
# OUTPUT:
# > 1-pnorm(700,494,100)
# [1] 0.01969927
pnorm(550,494,100)
#OUTPUT:
# > pnorm(550,494,100)
# [1] 0.7122603
pnorm(600,494,100)-pnorm(300,494,100)
#OUTPUT:
# > pnorm(600,494,100)-pnorm(300,494,100)
# [1] 0.8292379
#2.Suppose during any hour in large departmental store, the average number of shoppers is 448,
# with the standard deviation of 21 shoppers. What is the probability that a random sample of 49
# different shopping hours will yield a sample mean between 441 and 446 shoppers.
Sample_mean <- 448
Sample_sd <- 21
Sample_size <- 49
pnorm(446,Sample_mean,Sample_sd/sqrt(Sample_size))-pnorm(441,Sample_mean,Sample_sd/sqrt(Sample_size))
# OUTPUT:
# > pnorm(446,Sample_mean,Sample_sd/sqrt(Sample_size))-pnorm(441,Sample_mean,Sample_sd/sqrt(Sample_size))
# [1] 0.2426772
# 3.Mercury makes a 2.4 lt V-6 engine, The Laser XRi, used in speedboats. The companies engineer believe
# that the engine delivers an average power of 220 horsepower and that the standard deviation of power
# delivered is 15 horsepower. A potential buyer intends to sample 100 engines(each engine to be run a
# single time). What is the probability that the sample mean will be less than 217 horsepower?
Avg_power <- 220
Sample_sd <- 15
Sample_size <- 100
pnorm(217,Avg_power,Sample_sd/sqrt(Sample_size))
# OUTPUT:
# > pnorm(217,Avg_power,Sample_sd/sqrt(Sample_size))
# [1] 0.02275013
#4.Comcast, the computer services company, is planning to invest heavily in online television services. As
# part of the decision, the company wants to estimate the average no of online shows a family of four would
# watch per day. A random sample of n=100 families is obtained, and in this sample the average no of shows
# viewed per day is 6.5 and the population standard deviation is known to be 3.2. Construct a 95%
# confidence interval for the average no of online television shows watched by the entire population of
# families of four.
Sample_mean <- 6.5
Pop_Sd <- 3.2
Sample_size <- 100
CI <- 0.95
z <- qnorm(0.975)
mean_1 <- Sample_mean + z*(Pop_Sd/sqrt(Sample_size))
mean_2 <- Sample_mean - z*(Pop_Sd/sqrt(Sample_size))
mean_1
mean_2
# OUTPUT:
# > Sample_mean <- 6.5
# > Pop_Sd <- 3.2
# > Sample_size <- 100
# > CI <- 0.95
# >
# > z <- qnorm(0.975)
# > mean_1 <- Sample_mean + z*(Pop_Sd/sqrt(Sample_size))
# > mean_2 <- Sample_mean - z*(Pop_Sd/sqrt(Sample_size))
# > mean_1
# [1] 7.127188
# > mean_2
# [1] 5.872812
# 5. A stock market analyst wants to estimate the average return on a certain stock. A random sample of 15
# days yields an average (annualized) return of Xbar=10.37% and a standard deviation of s=3.5%. Assuming
# a normal population of returns, give a 95% confidence interval for the average return on this stock.
Sample_size <- 15
Sample_mean <- 10.37
Sample_sd <- 3.5
CI <-0.95
# Here Pop Standard Deviation is not know so we cannot use Z-Distrubution
# So we use T-Distrubution
t <- qt(0.975,Sample_size-1)
Pop_Mean1 <- Sample_mean + t*(Sample_sd /sqrt(Sample_size))
Pop_Mean2 <- Sample_mean - t*(Sample_sd /sqrt(Sample_size))
Pop_Mean1
Pop_Mean2
# OUTPUT:
# > Pop_Mean1
# [1] 12.30824
# > Pop_Mean2
# [1] 8.431765

#1