Re: Linear regression w/ confidence intervals



Tobin Fricke wrote:
1. The 'regress' function, which does linear least squares best-fit regression, outputs confidence intervals for the best-fit parameters that it comes up with. How are these confidence intervals computed, and how should they be interpreted?

Hi Tobin -

The parameter confidence intervals computed by REGRESS are completely standard, based on mse*inv(X'*X), though of course not computed that way. Any book on linear regression will describe these.

2. I have some data Y and regressors X; I also know the variance of each of the data points Y (since the vector Y was obtained by averaging many vectors). I would like to do *weighted* linear least squares regression taking into account the variance (error) of each point. How is this best accomplished? I see that the nonlinear fitting routines accept a 'weight' option--how do I translate variances into weights?

It's not exactly clear to me what you're saying you know about the variances of each measurement.


The LSCOV function handles weighted regression, and will return standard errors, but not confidence intervals. You can fool REGRESS into computing a weighted regression by using yw = y.*sqrt(w) and Xw = X.*repmat(sqrt(w),1,size(X,2)), where w is your vector of weights.

Ordinarily, you'd want to use the number of raw observations that went into each element of your response vector as your weights -- those are proportional to the reciprocal of the variances. But the statement, "I also know the variance of each of the data points (since the vector Y was obtained by averaging many vectors)" might mean several things. I'm assuming you have a different number of raw measurements that went into each observation that you have, and the number is different for each observation.

Hope this helps.

- Peter Perkins
  The MathWorks, Inc.
.



Relevant Pages

  • Re: A multiple regression stumper
    ... > variable in a standard multiple regression model. ... > of optimal weights that minimize the variance of e. ... > I would like to compute R2 for non-optimal sets of weights. ...
    (sci.stat.math)
  • Proposed CPAN module Statistics::LineFit
    ... statistics, the predicted y values and the residuals of the y ... weights are input in a separate array. ... method to check the status of the regression. ... regress- Do the least squares line fit ...
    (comp.lang.perl.modules)
  • Re: weighted regression
    ... Tom Lane wrote: ... >>> i'm trying to do a weighted regression in matlab but do not ... plus a vector of weights. ... > Nonlinear Regression" in the Statistics Toolbox. ...
    (comp.soft-sys.matlab)
  • Re: A multiple regression stumper
    ... > variable in a standard multiple regression model. ... > of optimal weights that minimize the variance of e. ... > I would like to compute R2 for non-optimal sets of weights. ...
    (sci.stat.math)
  • Re: nonlinear regression for dummies
    ... > variance, chi-squared, and so forth. ... But the output of the regression ... is easier and simpler, ordinary least squares regression. ... you would learn that the ANOVA model ordinarily ...
    (sci.stat.edu)