# [R] how to compute Bonferroni, Tukey's, Sheffe 95%-condence intervals for coefficients B1, B2, B3 in linear regression?

Greg Snow 538280 at gmail.com
Thu May 5 20:43:13 CEST 2016

```OK, I think that I understand better.  In your original post it
appeared that you already had used the multcomp package.  But now it
looks like you have heard that multcomp is the tool to use, but you
don't know how to use it, is that correct?

p.s.  It is best to keep these discussions on the list, others may be
quicker to respond and/or have better answers.

On Thu, May 5, 2016 at 10:34 AM, super <desolator88 at 163.com> wrote:
>
> OK, Let me show u an example:
>
>
>
>> fit <- lm( mpg ~ disp, data = mtcars)
>> confint(fit)
>                   2.5 %      97.5 %
> (Intercept) 27.08843246 32.11127705
> disp        -0.05083797 -0.03159227
> Now i have a 95% CI for b0 and b1,  and i don't what the name for this CI, may be default CI. Now I want to get some other CIs for b0 and b1, the CIs are Bonferroni,  Tukey's and Sheffe CIs,   Have i explained clearly? And I don't know at all how to do it.... I only heard these CIs in Multcomp package, but i totally don't understand how to compute these CIs for coefficients of linear regression. So i asked u for help, i hope u can understand me. Any help can be useful whether you show me related  package, code or  how to compute the CIs.  Note that, my question is how to compute these CIs for coefficients not the difference in means for different groups.
>
>
>
>
>
>
> At 2016-05-05 23:27:54, "Greg Snow" <538280 at gmail.com> wrote:
>>Super,
>>
>>Are you just interested in having the final intervals computed for
>>you?  Or are you trying to compute them yourself so that you can learn
>>more about what they do?  Or something else?
>>
>>If the first is the case then you can just use the multicomp package
>>as you have mentioned.  David was assuming that this was your approach
>>and wanted to know why that was not good enough, what you did with
>>multicomp and why you were not satisfied with the results.  If you are
>>happy using multicomp and just are not seeing a piece that you are
>>expecting, then show us what you have tried,  what the results are,
>>what you expect the results to be, and how the last 2 differ.  Then we
>>
>>If your goal is to learn, then re-inventing the wheel can be a good
>>thing, but make it clear that learning is the important part, not just
>>getting an answer.  Also show us what you have done so far, what
>>references you are using for the formulas, and where you are stuck.
>>
>>If your goal is something else, then give us more details.
>>
>>On Wed, May 4, 2016 at 10:44 PM, super <desolator88 at 163.com> wrote:
>>>
>>>
>>> Tks for you attention, i want to know Bonferroni, Tukey's, Sheffe 95%-condence intervals for coefficients in linear regression, for example,
>>> fit <- lm(y ~ x1 + x2)
>>> confint(fit) would give b0,b1,b2 95%CIs, but i want to get Bonferroni, Tukey's, Sheffe 95%-condence intervals for these coefficients. Do anyone happen to know it?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> At 2016-05-05 03:55:45, "David Winsemius" <dwinsemius at comcast.net> wrote:
>>>>
>>>>> On May 4, 2016, at 7:45 AM, super <desolator88 at 163.com> wrote:
>>>>>
>>>>>
>>>>> Dear experts,
>>>>>    I have a problem in compute Bonferroni,Tukey's,Sheffe 95%-condence intervals for coefficients B1,B2,B3 in linear regression using R? how can i do it? I only know how to compute these three cofindence intervals in multicomparsion by using multcomp package, and i am search a lot for how to comupte the three CIs for linear regression coefficients but without any useful information, so, plz help me ~
>>>>
>>>>Your question does not detail where the 'confint' function in pkg:multcop is letting you down. After the first few lines of the first example I type:
>>>>
>>>>confint(wht)
>>>>
>>>>#---------------
>>>>And get:
>>>>
>>>>        Simultaneous Confidence Intervals
>>>>
>>>>Multiple Comparisons of Means: Tukey Contrasts
>>>>
>>>>
>>>>Fit: aov(formula = breaks ~ wool + tension, data = warpbreaks)
>>>>
>>>>Quantile = 2.4155
>>>>95% family-wise confidence level
>>>>
>>>>
>>>>Linear Hypotheses:
>>>>           Estimate lwr      upr
>>>>M - L == 0 -10.0000 -19.3536  -0.6464
>>>>H - L == 0 -14.7222 -24.0758  -5.3687
>>>>H - M == 0  -4.7222 -14.0758   4.6313
>>>>
>>>>
>>>>Subsequent examples on that page use linear regression models as there starting point.
>>>>
>>>>--
>>>>
>>>>David Winsemius
>>>>Alameda, CA, USA
>>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>>
>>--
>>Gregory (Greg) L. Snow Ph.D.
>>538280 at gmail.com

--
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com

```