Re: Linear regression with uncertainties of the independent variable

John Frain via Help-octave <[email protected]> Fri, 4 Mar 2022 23:32:33 +0000
Newsgroups gmane.comp.gnu.octave.general
Message-ID <CAJWf-11v82n2cu2aRXHgU+DM-6M_0-H6bxZfuD3=WJjkftGkVA@mail.gmail.com>
Standard OLS can be used in circumstances where y and the X variables are
stochastic,  The basic assumptions are

   1. in the population the variables y, x_1, x_2,...,x_p follow a
   multivariate distribution
   2. y = \beta_1 x_1 + \beta_2 x_2 +....+ \beta_p x_p + u, where y and the
   x's can be observed. The disturbance u can not be observed
   3. (Let x_1 = 1 corresponding to the constant term in the regression.)
   4. The conditional expectation E[u|x_1, x_2,...x_p] =0
   5. The expectation of the covariance matrix of the x's is not singular

If these conditions are satisfied both y and x are stochastic and the
standard OLS estimates of the coefficients are consistent and have
similar asymptotic properties to the Gauss Markov assumptions. This theory
does not specify constant variances.  Estimates of the standard errors can
be adjusted to take account of this heteroskedasticity. (HCSE or White or
Huber -White estimate). This is covered in most econometric textbooks.
 Wooldridge (2010), Econometric Analysis of Cross Section and Panel Data:
Second Edition, MIT, has a very good summary of this theory.  If needed, it
should be relatively easy to add this functionality to the ols command in
Octave.

You might also consider the free econometrics package gretl (
http://gretl.sourceforge.net/) which is a useful supplement to Octave.



John C Frain
3 Aranleigh Park
Rathfarnham
Dublin 14
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
https://jcfrain.wordpress.com/
https://jcfraincv19.wordpress.com/

mailto:[email protected]
mailto:[email protected]


On Fri, 4 Mar 2022 at 20:53, Jose Ramom Flores das Seixas <
[email protected]> wrote:

> Hi:
>
> I need to fit some data to a line, (xi,yi), using least squares, taking
> into account that both the dependent variable (yi) and the independent
> variable (xi) have uncertainties. The uncertainty is the same for all xi,
> but varies for different yi. Is there a function in octave that allows this
> adjustment to be made?
>
> The "LinearRegression" function in the "optim" package allows to fit the
> data taking into account the uncertainties of the dependent variable, yi,
> but ,if I understand correctly, it does not consider the uncertainties of
> xi.
>
>
> Cheers
>
> Ramom
>
> ----------
> We are transitioning to a web based forum
> for community help discussions at
> https://octave.discourse.group/c/help
>


----------
We are transitioning to a web based forum
for community help discussions at
https://octave.discourse.group/c/help