Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
weighted least squares

Subject: weighted least squares

From: edward kabanyas

Date: 9 Dec, 2010 11:42:04

Message: 1 of 5

Hi All,

I am planning to apply "lscov" to my data. Do you have any suggestion how to calculate weights factor "w" ?
-----
x = lscov(A,b,w), where w is a vector length m of real positive weights, returns the weighted least squares solution to the linear system A*x = b, that is, x minimizes (b - A*x)'*diag(w)*(b - A*x). w typically contains either counts or inverse variances.
------

Thanks for help.

Edward

Subject: weighted least squares

From: Torsten Hennig

Date: 9 Dec, 2010 12:08:21

Message: 2 of 5

> Hi All,
>
> I am planning to apply "lscov" to my data. Do you
> have any suggestion how to calculate weights factor
> "w" ?
> -----
> x = lscov(A,b,w), where w is a vector length m of
> real positive weights, returns the weighted least
> squares solution to the linear system A*x = b, that
> is, x minimizes (b - A*x)'*diag(w)*(b - A*x). w
> typically contains either counts or inverse
> variances.
> ------
>
> Thanks for help.
>
> Edward

As it says in the description, w(i) = 1/(s_i)^2
(estimate of the inverse variance of measurement i) or
w(i) = n_i (number of times measurement i should be
included in the regression).

Best wishes
Torsten.

Subject: weighted least squares

From: edward kabanyas

Date: 9 Dec, 2010 12:56:05

Message: 3 of 5

Hi Torsten,

Thanks for your reply. However, could you provide an example in more detail ?

For example, I have the following data.

x = [0.0724489580240604 0.0761537353320543 0.0673597885753840 0.0252107694782875 0.0342268390042021]
y = [0.252611981259190 0.0785535797051596 0.0315376054132424 0.0147392142107384 0.00761935961896751]

I will fit these data with weighted least squares. Thanks again for help.

Regards,
Edward


Torsten Hennig <Torsten.Hennig@umsicht.fhg.de> wrote in message <1145932120.82013.1291896533427.JavaMail.root@gallium.mathforum.org>...
> > Hi All,
> >
> > I am planning to apply "lscov" to my data. Do you
> > have any suggestion how to calculate weights factor
> > "w" ?
> > -----
> > x = lscov(A,b,w), where w is a vector length m of
> > real positive weights, returns the weighted least
> > squares solution to the linear system A*x = b, that
> > is, x minimizes (b - A*x)'*diag(w)*(b - A*x). w
> > typically contains either counts or inverse
> > variances.
> > ------
> >
> > Thanks for help.
> >
> > Edward
>
> As it says in the description, w(i) = 1/(s_i)^2
> (estimate of the inverse variance of measurement i) or
> w(i) = n_i (number of times measurement i should be
> included in the regression).
>
> Best wishes
> Torsten.

Subject: weighted least squares

From: Torsten Hennig

Date: 9 Dec, 2010 13:29:54

Message: 4 of 5

> Hi Torsten,
>
> Thanks for your reply. However, could you provide an
> example in more detail ?
>
> For example, I have the following data.
>
> x =
> [0.0724489580240604 0.0761537353320543 0.0673597885753
> 840 0.0252107694782875 0.0342268390042021]
> y =
> [0.252611981259190 0.0785535797051596 0.03153760541324
> 24 0.0147392142107384 0.00761935961896751]
>
> I will fit these data with weighted least squares.
> Thanks again for help.
>
> Regards,
> Edward
>
>
> Torsten Hennig <Torsten.Hennig@umsicht.fhg.de> wrote
> in message
> <1145932120.82013.1291896533427.JavaMail.root@gallium.
> mathforum.org>...
> > > Hi All,
> > >
> > > I am planning to apply "lscov" to my data. Do you
> > > have any suggestion how to calculate weights
> factor
> > > "w" ?
> > > -----
> > > x = lscov(A,b,w), where w is a vector length m of
> > > real positive weights, returns the weighted least
> > > squares solution to the linear system A*x = b,
> that
> > > is, x minimizes (b - A*x)'*diag(w)*(b - A*x). w
> > > typically contains either counts or inverse
> > > variances.
> > > ------
> > >
> > > Thanks for help.
> > >
> > > Edward
> >
> > As it says in the description, w(i) = 1/(s_i)^2
> > (estimate of the inverse variance of measurement i)
> or
> > w(i) = n_i (number of times measurement i should be
>
> > included in the regression).
> >
> > Best wishes
> > Torsten.

The estimate of the inverse variance of measurement i
can not be deduced from your data, but from the
errors related with your measurement
(accuracy of the measurement device, reliability
of the person who made meassurement i etc.).
If you have no information about these
factors, choose w(i) = 1 for all i
(i.e. ordinary least squares fitting).

Best wishes
Torsten.

Subject: weighted least squares

From: Özge Zülfikar

Date: 1 Dec, 2012 18:06:08

Message: 5 of 5

Hello Dear Edward,

Could you give an example about this weighted least square regression, I have two sets of data, x and y also I have w values, how will i calculate?

Thanks

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us