Opened 17 years ago
Closed 17 years ago
#565 closed defect (fixed)
Error in RSS calculus in LinReg function
Reported by: | Christian Paz | Owned by: | Víctor de Buen Remiro |
---|---|---|---|
Priority: | highest | Milestone: | |
Component: | Math | Version: | 1.1.6 |
Severity: | blocker | Keywords: | |
Cc: |
Description
When we run the following code, it is expected that the RSS value given by the Estimate and the LinReg function take the same value. Instead, LinReg returns 11.4009263094 and Estimate returns (the correct value) 0.2280185256.
This error may lead to incorrect decisions based on RSS measure. We think that it is calculated as the square of sigma, it is (n-p) * sigma (n: number of data, p: number of parameters).
Simulated data y = alfa+beta X+e
Using LinReg RSS (residual square sum ) is grown!
Real n=50; lenght of the simulated sample
Real alfa=1;
Real beta=2;
Real Sigma=0.5;
Matrix X1 = SetCol(NCopy(n, 1));
Matrix X2 = Rand(n,1,0,1);
Matrix X =X1|X2; explanatory Matrix
Matrix Y = RProd(X1, alfa)+RProd(X2, beta)
+ Gaussian(n, 1, 0, Sigma); response Matrix
Set Resp=LinReg(Y,X);
Using Estimate is fine!
Serie Yr = SetSer(MatSet(Y),y2005m02,Mensual);
Serie Const = CalInd(C,Mensual);
Serie Xr = SetSer(MatSet(X2),y2005m02,Mensual);
Set Input_1 = SetOfSet(
InputDef(0.1, Const),
InputDef(0.1, Xr)
);
Set SetAR = SetOfReal(1,1); Parte AR de ModelDef
Set SetMA = SetOfReal(1,1); Parte MA de ModelDef
Polyn Diferen = 1;
Set Model1 = ModelDef(
Yr, Serie Output,
1, Real FstTransfor,
0, Real SndTransfor,
12, Real Period,
0, Real Constant,
Diferen, Polyn Dif,
SetAR, Set AR,
SetMA, Set MA,
Input_1, Set Input,
Copy(Empty) Set NonLinInput
);
Set Resp2 = Estimate(Model1);
Change History (3)
comment:1 Changed 17 years ago by
Owner: | changed from Jorge to Víctor de Buen Remiro |
---|
comment:2 Changed 17 years ago by
Status: | new → assigned |
---|
Sets AR and MA must contain polynomials instead of real numbers.
Set SetAR = SetOfPolyn(1,1); Parte AR de ModelDef
Set SetMA = SetOfPolyn(1,1); Parte MA de ModelDef
I will try to see way Estimate doesn't shows the corresponding error message.
Also, I will try to unify criteria for diferent informative statistics as RSS.
For example, RSS of LinReg is returning RSA (Residuals Sum Average)
comment:3 Changed 17 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Problem has been solved in CVS HEAD (1.1.7)
We are working about this problem
Thanks to report it