Re: linear regression
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1637] Re: linear regression
- From: forest at ananke.MIT.EDU (Chris E. Forest)
- Date: Sat, 8 Jul 1995 03:05:26 -0400
- Organization: Massachvsetts Institvte of Technology
In article <3tda94$ni3 at news0.cybernetics.net> deb at Alceon.com (David E. Burmaster) writes: > Dear MathGroupers > > I have 20 pairs of data {xi, yi} for i = 1, 2, ...., 20 > and I want to fit a straight line using ordinary least-squares. > > I want to use the package Statistics`LinearRegression` to fit a model of > this form: > > y = a x + b, with x as the indep variable and y as the dep variable > > The package reports the best fit for the coefficients with estiamtes of > their standard errors... so far so good... > > Now for the question: Since the estimates for the two coefficients are > correlated, is there an easy way to get the correlation of ahat and bhat?? > > Or to draw the tilted ellipse of contours of their joint probability > distribution?? > > Thank you for your help! > > and Happy Fourth! > > Dave > David E. Burmaster > Alceon Corporation > Cambridge, MA > One can use CovarianceMatrix or CorellationMatrix in the OutputList option. These return the respective matrices for the bestfit coefficients. Since the covariances define the major and minor axes of the ellipse, I assume a parametric plot for an ellipse can be created from the coefficients and the covariances. I'll let someone more familiar with the appropriate graphics fill in the details. Looking at Draper and Smith, they show the confidence region as (beta - b)'X'X(beta - b) <= p s^2 F(p,v,1-alpha) where b = the regression coefficients vector, X = the data matrix, p = the number of fit coefficients, n = number of observations, v = n - p, and alpha is the standard confidence parameter. F() is the F-value for the given p,v, and 1-alpha parameters. See Statistics`ContinuousDistribution`FRatioDistribution[n1,n2] s^2 is a measure of mean square error of the fit. s^2 = (Y'Y - b'X'Y)/(v-1) Here beta is the vector of possible coefficients for the fit. beta = (a,b); b = (ahat, bhat); Constructing the function of the ellipse should be straight forward from the above relationship. Might want to look through the Statistics Packages to find a way of getting the F-value for a desired alpha value. e.g. InverseStatisticalFunctions ?? Good luck. -- Chris E. Forest forest at ananke.mit.edu