Thread Subject: bug in lscov?

Subject: bug in lscov?

From: Hua Wang

Date: 2 Nov, 2009 18:29:03

Message: 1 of 6

Dear all,

I am using lscov to solve overdetermined equations. But it give a negative value for mse. It seems strange because I think mse should always be positive. For a system of equations A*x=b with covariance C, the test data are as following:

A= [0.1916 0.0438; 0.1916 0.0438; 0.0027 0.2873]
b=[ -8.9529; -8.1758; -6.0001]
C=[ 49.3974 0 0; 0 13.3209 12.4849; 0 12.4849 46.8052]

When I run script [x,stdx,mse,S]=lscov(A,b,C), stdx=[ 0 + 0.0220i; 0 + 0.0081i] and mse=-4.7684e-07. However, when I use the formular described in the lscov help document, it gives positive value for mse and real values for stdx.

The above data were tested under matlab-2009a. These data works in matlab-2007a. But even under 2007a, it also has the same problem for another dataset. I am not sure whether it is a bug in matlab or something is wrong with me.

PS: the above data are copied from matlab command window, so all of them have also 4 digital precision.

Regards,
Hua

Subject: bug in lscov?

From: Peter Perkins

Date: 2 Nov, 2009 18:51:38

Message: 2 of 6

Hua Wang wrote:

> The above data were tested under matlab-2009a. These data works in matlab-2007a. But even under 2007a, it also has the same problem for another dataset. I am not sure whether it is a bug in matlab or something is wrong with me.

Hua, This seems like kind of a funny set of data, but nonetheless, something that LSCOV should handle. And when I run the following under R2009a (and 9b), on WinXP, I see a result that seems correct given the inputs:

>> A = [0.1916 0.0438; 0.1916 0.0438; 0.0027 0.2873];
>> b = [-8.9529; -8.1758; -6.0001];
>> C = [49.3974 0 0; 0 13.3209 12.4849; 0 12.4849 46.8052];
[x,std,mse,S] = lscov(A,b,C)
x =
  -38.7185
  -21.0590
std =
    1.4984
    2.2716
mse =
    0.0096
S =
    2.2452 0.5182
    0.5182 5.1600

What do you get from "which -all lscov"? Are you running on Windows? Are you using the default BLAS and so on?

Subject: bug in lscov?

From: Hua Wang

Date: 2 Nov, 2009 19:38:02

Message: 3 of 6

Peter Perkins <Peter.Perkins@MathRemoveThisWorks.com> wrote in message <hcn9nq$qt9$1@fred.mathworks.com>...
> Hua Wang wrote:
>
> > The above data were tested under matlab-2009a. These data works in matlab-2007a. But even under 2007a, it also has the same problem for another dataset. I am not sure whether it is a bug in matlab or something is wrong with me.
>
> Hua, This seems like kind of a funny set of data, but nonetheless, something that LSCOV should handle. And when I run the following under R2009a (and 9b), on WinXP, I see a result that seems correct given the inputs:
>
> >> A = [0.1916 0.0438; 0.1916 0.0438; 0.0027 0.2873];
> >> b = [-8.9529; -8.1758; -6.0001];
> >> C = [49.3974 0 0; 0 13.3209 12.4849; 0 12.4849 46.8052];
> [x,std,mse,S] = lscov(A,b,C)
> x =
> -38.7185
> -21.0590
> std =
> 1.4984
> 2.2716
> mse =
> 0.0096
> S =
> 2.2452 0.5182
> 0.5182 5.1600
>
> What do you get from "which -all lscov"? Are you running on Windows? Are you using the default BLAS and so on?

Thanks Peter! I am running on 64-byte Linux.

I ran again with the the above data and it works the same with you. I guess it is the problem of only 4 digital decimal precision were copyed from the command window. How can I show you the original high precision data (more decimal numbers)?

Hua

Subject: bug in lscov?

From: Peter Perkins

Date: 2 Nov, 2009 19:48:35

Message: 4 of 6

Hua Wang wrote:
> Peter Perkins <Peter.Perkins@MathRemoveThisWorks.com> wrote in message <hcn9nq$qt9$1@fred.mathworks.com>...
>> What do you get from "which -all lscov"? Are you running on Windows? Are you using the default BLAS and so on?
> I ran again with the the above data and it works the same with you. I guess it is the problem of only 4 digital decimal precision were copyed from the command window. How can I show you the original high precision data (more decimal numbers)?

Assuming this is reproducible, and assuming you see the right thing for "which -all lscov", i.e., something like

   [MATLABROOT]\toolbox\matlab\matfun\lscov.m

then you should probably contact Technical Support. Or perhaps type "format long g" and try posting values with more digits.

Subject: bug in lscov?

From: Steven Lord

Date: 2 Nov, 2009 21:14:57

Message: 5 of 6


"Peter Perkins" <Peter.Perkins@MathRemoveThisWorks.com> wrote in message
news:hcnd2j$qm6$1@fred.mathworks.com...
> Hua Wang wrote:
>> Peter Perkins <Peter.Perkins@MathRemoveThisWorks.com> wrote in message
>> <hcn9nq$qt9$1@fred.mathworks.com>...
>>> What do you get from "which -all lscov"? Are you running on Windows?
>>> Are you using the default BLAS and so on?
>> I ran again with the the above data and it works the same with you. I
>> guess it is the problem of only 4 digital decimal precision were copyed
>> from the command window. How can I show you the original high precision
>> data (more decimal numbers)?
>
> Assuming this is reproducible, and assuming you see the right thing for
> "which -all lscov", i.e., something like
>
> [MATLABROOT]\toolbox\matlab\matfun\lscov.m
>
> then you should probably contact Technical Support. Or perhaps type
> "format long g" and try posting values with more digits.

If you contact Technical Support, save your data to a MAT-file and send it
to them; alternately, if you can't send a MAT-file then display the data
using "format hex" and we can use HEX2NUM to exactly reproduce the data
here.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: bug in lscov?

From: Sunke

Date: 11 Mar, 2011 22:28:06

Message: 6 of 6

Any news about negative mean squared error (MSE) output of LSCOV?
Since I am having the same problem (MAC, 64bit, ML2010b).
It is reproducable.
The weird thing is:
I hand many times (for many different global locations) a matrix to LSCOV as 'b' value, the 2nd, 3rd and 4th parameter get reasonable MSE values, but my first parameter in b, the MSE looks like gaussian noise around zero.
The MSE of the other parameters show (on a global map) reasonable areas of changing MSE, depending on data coverage and local variability.

Therefor I assume the problem is within my 'b' data and not within A or the weight vector w, that I do use.

Any ideas? help?

Tags for this Thread

Everyone's Tags:

lscov(2), bug(2), mse(2), complex, negative

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
bug Sunke 11 Mar, 2011 17:29:21
negative Sunke 11 Mar, 2011 17:29:21
mse Sunke 11 Mar, 2011 17:29:21
lscov Sunke 11 Mar, 2011 17:29:21
complex Hua Wang 2 Nov, 2009 13:34:04
mse Hua Wang 2 Nov, 2009 13:34:04
bug Hua Wang 2 Nov, 2009 13:34:04
lscov Hua Wang 2 Nov, 2009 13:34:03
rssFeed for this Thread

Contact us at files@mathworks.com