Prev: Passing data between functions in a GUI
Next: reshape
From: Peter Perkins on 9 Mar 2010 14:12 On 3/9/2010 12:45 PM, Ahren Ceisel wrote: > I am using the regress function to do linear fits of a number of > three-dimensional data sets (two regressors and one observation) and > seem to be getting R^2 values greater than 1 for some of the sets. From > the info in Matlab's help, I get the impression that the first element > in the "stats" vector that regress outputs is supposed to be the R^2 > value. Am I looking at the wrong number or am I incorrect in my > understanding that R^2 should never be greater than 1? Ahren, are you perhaps using complex input data?
From: Aaron on 9 Mar 2010 14:21 Peter Perkins <Peter.Perkins(a)MathRemoveThisWorks.com> wrote in message <hn66i3$8at$1(a)fred.mathworks.com>... > On 3/9/2010 12:45 PM, Ahren Ceisel wrote: > > I am using the regress function to do linear fits of a number of > > three-dimensional data sets (two regressors and one observation) and > > seem to be getting R^2 values greater than 1 for some of the sets. From > > the info in Matlab's help, I get the impression that the first element > > in the "stats" vector that regress outputs is supposed to be the R^2 > > value. Am I looking at the wrong number or am I incorrect in my > > understanding that R^2 should never be greater than 1? > > Ahren, are you perhaps using complex input data? Nope--all inputs and outputs are positive real numbers.
From: Jos (10584) on 9 Mar 2010 14:36 "Aaron " <ceisahr(a)iit.edu> wrote in message <hn672u$8v6$1(a)fred.mathworks.com>... > Peter Perkins <Peter.Perkins(a)MathRemoveThisWorks.com> wrote in message <hn66i3$8at$1(a)fred.mathworks.com>... > > On 3/9/2010 12:45 PM, Ahren Ceisel wrote: > > > I am using the regress function to do linear fits of a number of > > > three-dimensional data sets (two regressors and one observation) and > > > seem to be getting R^2 values greater than 1 for some of the sets. From > > > the info in Matlab's help, I get the impression that the first element > > > in the "stats" vector that regress outputs is supposed to be the R^2 > > > value. Am I looking at the wrong number or am I incorrect in my > > > understanding that R^2 should never be greater than 1? > > > > Ahren, are you perhaps using complex input data? > > Nope--all inputs and outputs are positive real numbers. Perhaps it is time you post your data set and syntax ... Jos
From: Wayne King on 9 Mar 2010 14:41 "Aaron " <ceisahr(a)iit.edu> wrote in message <hn672u$8v6$1(a)fred.mathworks.com>... > Peter Perkins <Peter.Perkins(a)MathRemoveThisWorks.com> wrote in message <hn66i3$8at$1(a)fred.mathworks.com>... > > On 3/9/2010 12:45 PM, Ahren Ceisel wrote: > > > I am using the regress function to do linear fits of a number of > > > three-dimensional data sets (two regressors and one observation) and > > > seem to be getting R^2 values greater than 1 for some of the sets. From > > > the info in Matlab's help, I get the impression that the first element > > > in the "stats" vector that regress outputs is supposed to be the R^2 > > > value. Am I looking at the wrong number or am I incorrect in my > > > understanding that R^2 should never be greater than 1? > > > > Ahren, are you perhaps using complex input data? > > Nope--all inputs and outputs are positive real numbers. Hi Ahren, I'd have to work this out, but R^2=1-SSE/SSTOT may not hold when there is no constant term. In other words, the relation you are citing is typically derived from partitioning the total sum of squares into the error sum of squares plus the regression sum of squares. Dividing SSTOT=SSE+SSReg by SSTOT you obtain 1=SSE/SSTOT+R^2, or R^2=1-SSE/SSTOT. I'd caution you to make sure that SST=SSE+SSReg holds without a constant term. Like I said I'd have to work it out and Peter is certainly the expert here, but it's something to consider. See http://www.mathworks.com/access/helpdesk/help/toolbox/stats/regress.html for the note on a negative R^2 without a constant term. Wayne
From: Peter Perkins on 9 Mar 2010 17:12
On 3/9/2010 2:36 PM, Jos (10584) wrote: > Perhaps it is time you post your data set and syntax ... And the version of MATLAB you're using. Thanks. |