Question

In: Math

ANSWER USING R CODE Using the dataset 'LakeHuron' which is a built in R dataset describing...

ANSWER USING R CODE

Using the dataset 'LakeHuron' which is a built in R dataset describing the level in feet of Lake Huron from 1872- 1972. To assign the values into an ordinary vector,x, we can do the following 'x <- as.vector(LakeHuron)'. From there, we can access the data easily. Assume the values in X are a random sample from a normal population with distribution X. Also assume the X has an unknown mean and unknown standard deviation. With this information in mind, answer the following.

a) The sample mean of x

b) the sample mean of 8X

c) Using this data, create a 97% confidence interval for X using the a t-distribution critical value tstar.

d) Using this data, create a 3 percent level test of H0:mu = 578.9 versus the alternative Ha:mu > 578.9. USing tis information, calculate the value of the z-statistic

e) With the z-statistic, calculate the appropriate p-value.

Solutions

Expert Solution

The code with explanation is given below.

Code is pasted below so that you can copy and run in R Studio

x <- as.vector(LakeHuron)

# a) sample mean of x
mu <- mean(x)

# b) sample mean of 8X
mu2 <- mean(8*x)

# c) 97% confidence interval for X using the a t-distribution
n <- length(x) #Sample size
se <- sd(x) /sqrt(n) #Standard error of sampole mean
conf <- 0.97 #Confidence level.
alpha <- 1 - conf #Significance level
df <- n - 1 #Degree of freedom
Lower.Conf = mu - se * qt(1 - alpha/2, df)
Upper.Conf = mu + se * qt(1 - alpha/2, df)

#d) H0:mu = 578.9 ; Ha:mu > 578.9

z = (578.9 - mu)/se # Test statistic z
p.value = pnorm(z, lower.tail = FALSE) # P-value
if(p.value < 0.03 ) {
print("We reject H0 and conclude that there is significant evidence of Ha")
} else {
print("We fail to reject H0 and conclude that there is no significant evidence of Ha")
}

# e)
# Calculated in line 21

After running the code, I got below output

a) The sample mean of x = 579.0041

b) the sample mean of 8X = 4632.033

c) Using this data, create a 97% confidence interval for X using the a t-distribution critical value tstar.

(578.7108, 579.2974)

d) Using this data, create a 3 percent level test of H0:mu = 578.9 versus the alternative Ha:mu > 578.9. USing tis information, calculate the value of the z-statistic

z = - 0.7815799

We fail to reject H0 and conclude that there is no significant evidence of Ha

e) With the z-statistic, calculate the appropriate p-value.

0.7827692


Related Solutions

warpbreaks is a built-in R dataset which gives This data set gives the number of warp...
warpbreaks is a built-in R dataset which gives This data set gives the number of warp breaks per loom, where a loom corresponds to a fixed length of yarn. We are interested in some descriptive statistics related to the warpbreaks dataset. We can access this data directly and convert the time series into a vector by using the assignment x <- warpbreaks$breaks. (In R, use ? warpbreaks for info on this dataset.) The values of x if assigned as above...
Using dataset "PlantGrowth" in R (r code) Construct a 95% confidence interval for the true mean...
Using dataset "PlantGrowth" in R (r code) Construct a 95% confidence interval for the true mean weight. Interpret the confidence interval in in the context of the problem.
Load the USArrests sample dataset from the built-in datasets (data(USArrests)) into R using a dataframe (Note:...
Load the USArrests sample dataset from the built-in datasets (data(USArrests)) into R using a dataframe (Note: Row names are states, not numerical values!). Use the kmeans package to perform a clustering of the data with increasing values of k from 2 to 10 - you will need to decide whether or not to center/scale the observations - justify your choice. Plot the within-cluster sum of squares for each value of k - what is the optimal number of clusters? Use...
I need this in R code please: Use the dataset ’juul’ in package ’ISwR’ to answer...
I need this in R code please: Use the dataset ’juul’ in package ’ISwR’ to answer the question. (1) Conduct one-way ANOVA test to test if the mean of igf1 of each level of tanner are the same? (2) What is the mean of igf1 in each level of tanner? (3) If there is any difference, which ones appear to be different? (Use pairwise t test for each pair of level with bonferroni method)
Instructions tell you how to get the data in R R has built in dataset called...
Instructions tell you how to get the data in R R has built in dataset called Iris. This famous (Fisher's or Anderson's) iris data set gives the measurements in centimeters of the variables sepal length and width and petal length and width, respectively, for 50 flowers from each of 3 species of iris. The species are Iris setosa, versicolor, and virginica. We are interested in estimating the length of Petal (Y) using the length of Sepal (X). First, load the...
Fitting a linear model using R a. Read the Toluca.txt dataset into R (this dataset can...
Fitting a linear model using R a. Read the Toluca.txt dataset into R (this dataset can be found on Canvas). Now fit a simple linear regression model with X = lotSize and Y = workHrs. Summarize the output from the model: the least square estimators, their standard errors, and corresponding p-values. b. Draw the scatterplot of Y versus X and add the least squares line to the scatterplot. c. Obtain the fitted values ˆyi and residuals ei . Print the...
Solve it by R Use the “d_logret_6stocks” dataset to answer the questions. Test by using α=...
Solve it by R Use the “d_logret_6stocks” dataset to answer the questions. Test by using α= .01. (General Motor: GenMotor). (1) Regress the return of General Motor on the returns of Citigroup (with intercept). Report the estimated coefficients. Is there any evidence to show strong linear relationship between these two variables at significance level 5%? (2) Suppose we “know” the return of Citigroup tomorrow is 0.05, what is the predicted return of General Motor tomorrow? (3) Compute the correlation of...
R has a number of datasets built in. One such dataset is called mtcars. This data...
R has a number of datasets built in. One such dataset is called mtcars. This data set contains fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973-74 models) as reported in a 1974 issue of Motor Trend Magazine. We do not have to read in these built-in datasets. We can just attach the variables by using the code attach(mtcars) We can just type in mtcars and see the entire dataset. We can see the variable...
In R: Consider dataset “juul” from library “ISwR”. (juul is a built in data set) Are...
In R: Consider dataset “juul” from library “ISwR”. (juul is a built in data set) Are the means of igf1 equal among tanner groups at 5% level? Please use the six step process to test statistical hypotheses for this research problem. Note: You need to convert tanner from numeric to factor type and ignore all the NAs.
The Book of R (Question 20.2) Please answer using R code. Continue using the survey data...
The Book of R (Question 20.2) Please answer using R code. Continue using the survey data frame from the package MASS for the next few exercises. The survey data set has a variable named Exer , a factor with k = 3 levels describing the amount of physical exercise time each student gets: none, some, or frequent. Obtain a count of the number of students in each category and produce side-by-side boxplots of student height split by exercise. Assuming independence...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT