Kyle Matoba
2008-Nov-29 23:30 UTC
[R] function for simultaneous confidence interval of regression coefficients
List, Would someone be so kind as to point me to a function that will calculate simultaneous confidence intervals of regression coefficients based upon their distribution as (under the assumption of normal errors, with \mathbf{X} as the design matrix): $\hat{\mathbf{\beta}} \sim N(\mathbf{\beta}, \sigma^2(\mathbf{X}^T\mathbf{X})^{-1})$. 'confint' calculates individual coefficients so far as I can tell, but I need simultaneous CIs based on the confidence ellipse/ F distribution. Inverting the ellipse gives this equation: \mathbf{\hat{\beta}} \pm \sqrt{\mathrm{diag}(s^2(\mathbf{X}^T\mathbf{X})^{-1}) \times p \times F_{p, n-p, .95}} Thanks, and sorry for such a dumb question. Either I am not searching for the right thing or this hasn't already been addressed in the lists (perhaps because it is so easy). Kyle [[alternative HTML version deleted]]
Kingsford Jones
2008-Nov-30 20:11 UTC
[R] function for simultaneous confidence interval of regression coefficients
see ?coef # extract the estimates ?vcov # extract their covariance matrix ?qf # get the F quantile of interest Also, you may be interested in ?car::ellipse ?ellipse::ellipse.lm ?gmodels::glht.test hth, Kingsford Jones On Sat, Nov 29, 2008 at 4:30 PM, Kyle Matoba <kylematoba at gmail.com> wrote:> List, > > Would someone be so kind as to point me to a function that will calculate > simultaneous confidence intervals of regression coefficients based upon > their distribution as (under the assumption of normal errors, with > \mathbf{X} as the design matrix): > > $\hat{\mathbf{\beta}} \sim N(\mathbf{\beta}, > \sigma^2(\mathbf{X}^T\mathbf{X})^{-1})$. > > > 'confint' calculates individual coefficients so far as I can tell, but I > need simultaneous CIs based on the confidence ellipse/ F distribution. > Inverting the ellipse gives this equation: > > \mathbf{\hat{\beta}} \pm > \sqrt{\mathrm{diag}(s^2(\mathbf{X}^T\mathbf{X})^{-1}) \times p \times F_{p, > n-p, .95}} > > Thanks, and sorry for such a dumb question. Either I am not searching for > the right thing or this hasn't already been addressed in the lists (perhaps > because it is so easy). > > Kyle > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >