In: Statistics and Probability
SOLVE THE FOLLOWING USING STATISTICAL SOFTWARE R. SHOW YOUR CODE AND ANSWERS, USING AN RMD FILE (SHOW ANSWERS IN R MARKDOWN FORWAT WITH CODE AND ANSWERS)
PROBLEM 1
A study of 400 glaucoma patients yields a sample mean of 140 mm and a sample standard deviation of 25 mm for the the following summaries for the systolic blood pressure readings. Construct the 95% and 99% confidence intervals for μ, the population average systolic blood pressure for glaucoma patients.
PROBLEM 2
Suppose that fasting plasma glucose concentrations (FPG) in some population are normally distributed
with a mean of 90 mg/dl and standard deviation of 5 mg/dl.
(a) Among 1,000 people randomly selected from this population, how many would you expect to have
FPG less than 80 mg/dl?
(b) If you draw 25 people from this population, what is the probability that the sample average is larger
than 92 mg/dl?
(c) If you select 5 people from this population, what is the probability that 4 or more of them have a
FPG larger than 100 mg/dl?
Solution:
Problem statement: A statistical study is being conducted and for that study we have answer few questions using software "R".
Given:- For a set of glaucoma patients blood pressure and Fasting plasma glucose concentrations (FPG) is measured. Based on this we have to answer few questions in R.
Problem 1:-
R-Code
#Initialize sample mean and sample standard deviations of Blood
pressure
#sample mean=m
#sample standard deviation=s
#sample size=n
m <- 140
s <- 25
n <- 400
#calculate the interval limits at 95% and 99%
#error_95=computes limits for 95% range
#error_99=computes limits for 99% range
#left_95 and left_99 sets the lower limit of the interval
#right_95 and right_99 sets the higer limit of the interval
error_95 <- qt(0.975,df=n-1)*s/sqrt(n)
left_95 <- m-error_95
right_95 <- m+error_95
error_99 <- qt(0.995,df=n-1)*s/sqrt(n)
left_99 <- m-error_99
right_99 <- m+error_99
#output the results
print(left_95)
print(right_95)
print(left_99)
print(right_99)
Problem 2:-
R-Code for question (a)
#Intialize the population parameters given in question 2
#Population mean=M
#Population standard deviation is =S
M=90
S=5
#First find the probability of finding patients with fasting plasma
glucose concentrations less than 80 from this normal distribution
using z-score
Probability_lessthan80 <- pnorm(80, M, S)
#output probability
print(Probability_lessthan80)
#we have to compute out of 1000 people, how many people are
expected to have fasting plasma glucose concentrations less than
80
numberofsamples=1000
Expectednumberofpeople_below80=(Probability_lessthan80)*(numberofsamples)
#output answer
print(Expectednumberofpeople_below80)
R-code for question (b)
#Intialize the population parameters given in question 2
#Population mean=M
#Population standard deviation is =S
M=90
S=5
#First find the probability of finding patients with fasting plasma
glucose concentrations greater than 92 from this normal
distribution using z-score
sample_size=25
Probability_lessthan92 <- pnorm(92, M, S/sqrt(sample_size))
Probability_greaterthan92=1-Probability_lessthan92
#output answer
print(Probability_greaterthan92)
R-code for question (c)
#Intialize the population parameters given in question 2
#Population mean=M
#Population standard deviation is =S
M=90
S=5
#First find the probability of finding patients with fasting plasma
glucose concentrations greater than 100 from this normal
distribution using z-score
Probability_lessthan100 <- pnorm(100, M, S)
Probability_greaterthan100=1-Probability_lessthan100
#output probability
print(Probability_greaterthan100)
#This probability is a chance of success for binomial distribution
asked in the question
success=Probability_greaterthan100
number_people=5
#probability that 4 or more people will have fasting plasma glucose
concentrations greater than 100 is
probability_4ormorepeople=dbinom(4,number_people,
success)+dbinom(5,number_people, success)
#output answer
print (probability_4ormorepeople)
Please up vote the solution if it helpful......Thank
you