CORRCOEF confusion with zero intercept linear regression

5 visualizaciones (últimos 30 días)
Brian Scannell
Brian Scannell el 14 de Mzo. de 2014
Comentada: Star Strider el 14 de Mzo. de 2014
I want to do a simple linear regression and compare the R^2 correlation coefficient when the intercept is allowed to vary and when the intercept is forced to be zero. I am happy that I am correctly determining the coefficients and using them to calculate the y-values for the best-fit lines (they plot as I would expect).
I then use CORRCOEF to calculate the R value for the fit between the original y data and (a) the y data with the variable intercept; and (b) the y data with the zero intercept. However, I am getting exactly the same R value for both sets of predicted y values - despite the fact that the non-zero intercept line is visibly a much better fit to the data.
When I calculate R^2 by the individual steps outlined in the linear regression section of the documentation I get different values - the R^2 value for the non-zero intercept line being the square of the value I get from CORRCOEF.
Can anyone explain why CORRCOEF is giving me the same R value for both the zero and non-zero intercept predictions? I apologise if this is a dumb question, but I'm very much a novice for both MATLAB and the joys of statistical analysis.
More generally, if I have a negative R^2 value (derived from the step-wise calculation rather than CORRCOEF) is it normal practice to quote it as zero or to give the calculated negative value?
Thanks you.
  1 comentario
Star Strider
Star Strider el 14 de Mzo. de 2014
I must be missing something here. How could you get a negative R^2?
What are you doing?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Descriptive Statistics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by