Question

Give an example in R language about construct simultaneous confidence intervals based on T2 and Bonferroni correction.

Give an example in R language about construct simultaneous confidence intervals based on T2 and Bonferroni correction.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Forming Simultaneous Confidence Intervals in R

With the definitions and equations out of the way, we can explore how to build the simulatenous confidence intervals in R. The investr is the only package I’ve found that performs the Bonferroni and Working-Hotelling procedures. Of course, not being satisified with just using a package and calling it a day as I often am, we will build a custom function that creates intervals using both procedures to verify our understanding.

Start by loading the necessary packages and the delivery dataset.

library(robustbase)
## Warning: package 'robustbase' was built under R version 3.3.1
library(investr)
## Warning: package 'investr' was built under R version 3.3.1
library(ggplot2)
library(gridExtra)
data("delivery")
Fit linear models with each predictor variable.

dist.lm <- lm(delTime ~ distance, data = delivery)
prod.lm <- lm(delTime ~ n.prod, data = delivery)
Using the plotFit function from the investr package, plot the Bonferroni and Working-Hotelling confidence intervals. Setting the argument adjust to Scheffe instructs the function to build Working-Hotelling intervals.

par(mfrow=c(2,2))

plotFit(dist.lm, interval = 'confidence', adjust = 'Scheffe', main = 'Working-Hotelling DelTime ~ Distance')
plotFit(prod.lm, interval = 'confidence', adjust = 'Scheffe', main = 'Working-Hotelling DelTime ~ Products')

plotFit(dist.lm, interval = 'confidence', k = 0.95, adjust = 'Bonferroni', main = 'Bonferroni DelTime ~ Distance')
plotFit(prod.lm, interval = 'confidence', k = 0.95, adjust = 'Bonferroni', main = 'Bonferroni DelTime ~ Products')

Add a comment
Know the answer?
Add Answer to:
Give an example in R language about construct simultaneous confidence intervals based on T2 and Bonferroni correction.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Confidence Intervals 9. Construct a 95 % confidence interval for the population mean, . In a...

    Confidence Intervals 9. Construct a 95 % confidence interval for the population mean, . In a random sample of 32 computers, the mean repair cost was $143 with a sample standard deviation of $35 (Section 6.2) Margin of error, E. <με. Confidence Interval: O Suppose you did some research on repair costs for computers and found that the population standard deviation, a,- $35. Use the normal distribution to construct a 95% confidence interval the population mean, u. Compare the results....

  • Which of the following statements about confidence intervals is correct?   A The value of z* you...

    Which of the following statements about confidence intervals is correct?   A The value of z* you use when constructing a confidence interval will affect where the center of the interval is. B If you construct a confidence interval for a population proportion and the interval ends up being from 0.20 to 0.40, this means the population proportion is definitely between 0.20 and 0.40. C A confidence interval is an interval of values computed from sample data that is likely to...

  • are 1. Confidence intervals can be constructed only under certain assumptions about the samples and population....

    are 1. Confidence intervals can be constructed only under certain assumptions about the samples and population. For each Situation below, either (1) construct the confidence interval, or (ii) explain why you cannot (which assumption is missing) and (iii) what would a researcher need to change to be able to construct the confidence interval (a) Suppose SAT scores for a population of students is normally distributed. The SAT scores for 12 randomly selected 1130 1290 1010 1320 950 1250 1340 1100...

  • Pretty Problem #6 (Confidence Intervals) There is a general consensus that a person's height is about...

    Pretty Problem #6 (Confidence Intervals) There is a general consensus that a person's height is about the same as their wingspan. That is to say, if you calculate “Ape Index” (wingspan minus height in inches) we should get zero on average for a whole population of people. Since Rachael has super short arms (ape index of -3) and all her "friends” "lovingly” call her “t-rex arms” Rachael would like to think that she's not alone in the t-rex department and...

  • Problem 2: Problem 4 (20pts) For the data set in problem 2 construct 95% confidence intervals...

    Problem 2: Problem 4 (20pts) For the data set in problem 2 construct 95% confidence intervals for include zero, if no explain what does this mean? and explain the results. Does the interval The marketing department of Coca Cola wanted to analyze the relationship between the price of Coke and the demand for it. They were concerned that if they continue increasing the price, people will switch to Pepsi. Calculate Bo and B for the following data and give interpretation...

  • Using output given below, (a) Set-up simultaneous 95% confidence intervals for Bo and B1. (b) Set-up...

    Using output given below, (a) Set-up simultaneous 95% confidence intervals for Bo and B1. (b) Set-up a 95% confidence interval for u{5.1}= expected vo at a speed of 5.1. (c) What is the covariance between bo and by? What does it mean? OUTPUT 1, Speed Example The SAS System Obs speed vo 1 4.0 3.5 15.7 18.4 4.5 22.0 5.0 34.8 5.5 45.3 6.0 51.1 The SAS System The REG Procedure Model: MODEL 1 Dependent Variable: vo Analysis of Variance...

  • Suppose that you were asked to construct a 95% confidence interval based on the standard normal...

    Suppose that you were asked to construct a 95% confidence interval based on the standard normal distribution. Use software or a table of critical values from the standard normal distribution to determine the positive critical value, ?, for the confidence interval. Give your answer to two decimal places, rounding to the nearest value if necessary.

  • Out of 200 people sampled, 68 had kids. Based on this, construct a 95% confidence interval...

    Out of 200 people sampled, 68 had kids. Based on this, construct a 95% confidence interval for the true population proportion of people with kids. Give your answers as decimals, to three places

  • Out of 400 people sampled, 264 had kids. Based on this, construct a 95% confidence interval...

    Out of 400 people sampled, 264 had kids. Based on this, construct a 95% confidence interval for the true population proportion of people with kids. Give your answers as decimals, to three places

  • Out of 600 people sampled, 474 had kids. Based on this, construct a 99% confidence interval...

    Out of 600 people sampled, 474 had kids. Based on this, construct a 99% confidence interval for the true population proportion of people with kids. Give your answers as decimals, to four places <p<

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT