*Answer all questions using R-Script*
Question 1
Using the built in CO2 data frame, which contains data from an experiment on the cold tolerance of Echinochloa crus-galli; find the following.
a) Assign the uptake column in the dataframe to an object called "x"
b) Calculate the range of x
c) Calculate the 28th percentile of x
d) Calculate the sample median of x
e) Calculate the sample mean of x and assign it to an object called "xbar"
f) Calculate the interquartile range of x
g) Calculate the sample standard deviation of x and assign it to an object called "s"
h) Find the lower boundary for a 94 percent confidence interval for μ.
i) calculate the critical value for a 93 percent confidence interval for μ.
j) Find the upper boundary for a 94 percent confidence interval for μ.
k) how long is the 94 percent confidence interval for μ?
Question 2
Suppose A is a standard normal random variable and B is a normal random variable with mean 8 and standard deviation 11. Find the following:
a) Calculate the 29th percentile of the distribution of A
b) Calculate the 29th percentile of the distribution of B
c) What is the expected value of the random variable 7B-5
d) What is the standard deviation of the random variable 7B-5
e) What is the standard deviation of the random variable B*(-7/11)
Question 3
Let X 1, X 2, ... , X 12 come from a sample of the normal distribution. Suppose the sample mean is x and the sample standard deviation is s. With this information, we wish to test the null hypothesis H0:μ=35 against the alternative Ha:μ<35. Out test statistic will be (x-35)/(s*sqrt(12)). Our sample yields x = 33.15 and s = 1.96. Answer the following:
a) If xbar = 33.15 and s = 1.96 then what is the value of T?
b) How many degrees of freedom does this distribution have if T has a t distribution
c) If we test at the 2% level, then what is the critical value?
d) What is the p-value based upon our sample?
e) Do we reject the null hypothesis? (yes or no)
f) If we repeat a 2 % level test 400 times, about how many times do we expect to commit a type I error?
Question 4
Say we have two independent normal populations X and Y with known standard deviations σx = 5.1 and σy = 5.3 . We then take a random sample of size 7 from X (X1, X2, … X7) and a random sample from y of size 5 as follows
X: 10.75, 12.05, 2.25, 1.26, -1.43,
1.69, 15.28
Y: 6.95, 8.22, 7.95, 5.85, -2.44
Calculate the following using R:
a) Calculate xbar
b) calculate the variance of xbar
c) calculate ybar
d) calculate the variance of ybar
e) calculate the variance of xbar-ybar
f) What is the critical value used for a 95% confidence interval for μx - μy?
g) create a 95 % confidence interval for μx - μy.
h) what is the length of the 95% confidence interval for μx - μy?
i) What would the p value have been if we used this data to test H0:μx - μy=0 against the alternative Ha:μx - μy > 0?
Question 5
We desire to know the probability that a voter supports a controversial rose proposal. From a random sample of 3100, x =1331 voters support the rose proposal. Let phat be the sample proportion supporting the rose proposal. Answer the following:
a) what is the variance of p hat
b) As a function of p, what is the standard deviation of p hat
c) Calculate p hat
d) Let ptot be the random variable representing the voters in the sample who support the rose proposal. As a function of p, what is the standard deviation of ptot?
e) Calculate a classical 96% confidence interval for p
f) What is the critical value for an approximate classical 94 percent confidence interval for p?
g) What is the length of the 96% confidence interval for p?
h) Assuming the same phat value, what sample size would have made the 96% confidence interval for p to have a length of .08 or less?
Question 1
All R scripts are shown in bold
a) Assign the uptake column in the dataframe to an object called "x"
x = CO2$uptake
b) Calculate the range of x
range(x)
[1] 7.7 45.5
c) Calculate the 28th percentile of x
quantile(x, 0.28)
28%
18.292
d) Calculate the sample median of x
median(x)
[1] 28.3
e) Calculate the sample mean of x and assign it to an object called "xbar"
xbar = mean(x)
f) Calculate the interquartile range of x
IQR(x)
[1] 19.225
g) Calculate the sample standard deviation of x and assign it to an object called "s"
s = sd(x)
h) Find the lower boundary for a 94 percent confidence interval for μ.
For 94 percent confidence interval, = 1 - 0.94 = 0.06
Thus, the boundary intervals are 0.06/2 and 1 - 0.06/2 = 0.03 and 0.97
Lower limit = Mean - z * standard error
where Standard error = s / sqrt(n) where n is sample size
and z is z value for 94 percent confidence interval.
So, the R script is,
xbar - (qnorm(0.97) * s /
sqrt(length(x)))
[1] 24.99385
i) calculate the critical value for a 93 percent confidence interval for μ.
For 93 percent confidence interval, = 1 - 0.93 = 0.07
Thus, the boundary intervals are 0.07/2 and 1 - 0.07/2 = 0.035 and 0.965
The crirtical value of z for 93 percent confidence interval is
qnorm(0.965)
[1] 1.811911
Lower and upper limit of the confidence interval are
xbar - (qnorm(0.965) * s /
sqrt(length(x)))
[1] 25.07513
xbar + (qnorm(0.965) * s / sqrt(length(x)))
[1] 29.35106
j) Find the upper boundary for a 94 percent confidence interval for μ.
xbar + (qnorm(0.97) * s / sqrt(length(x)))
[1] 29.43234
k) how long is the 94 percent confidence interval for μ?
Calculate the lower and upper limit and then calculate their difference for length of the confidence interval.
ll = xbar - (qnorm(0.97) * s / sqrt(length(x)))
ul = xbar + (qnorm(0.97) * s / sqrt(length(x)))
ul - ll
[1] 4.438482
Get Answers For Free
Most questions answered within 1 hours.