Re: [R] lm without intercept

2012-08-14 Thread citynorman
The cor(mtcars$mpg, fitted(m0))^2 method works great - thanks so much Josh! I've had another instance (also ex intercept) where it actually gave the correct number, odd behavior. Thanks for the other posts also. As an aside, in my application a zero intercept makes economic sense and I'm using R

Re: [R] lm without intercept

2012-07-29 Thread peter dalgaard
On Feb 18, 2011, at 14:20 , Jan wrote: > One of the references you googled suggests that intercepts should never > be omitted. Is this true even if I know that the physical reality behind > the numbers suggests an intercept of zero? No. That'll be a piece of pragmatic advice caused by the experie

Re: [R] lm without intercept

2012-07-29 Thread peter dalgaard
On Feb 18, 2011, at 14:20 , Jan wrote: > Hello Achim, > >> Not quite. Consult your statistics textbook for the correct interpretation >> of p-values. Under the null hypothesis of a true intercept of zero, it is >> very likely to observe an intercept as large as 13.52 or larger. > thank you for

Re: [R] lm without intercept

2012-07-28 Thread Joshua Wiley
Hi, R actually uses a different formula for calculating the R square depending on whether the intercept is in the model or not. You may also find this discussion helpful: http://stats.stackexchange.com/questions/7948/when-is-it-ok-to-remove-the-intercept-in-lm/ If you conceptualize R^2 as the sq

Re: [R] lm without intercept

2012-07-28 Thread citynorman
I've just picked up R (been using Matlab, Eviews etc) and I'm having the same issue. Running reg=lm(ticker1~ticker2) gives R^2=50% while running reg=lm(ticker1~0+ticker2) gives R^2=99%!! The charts suggest the fit is worse not better and indeed Eviews/Excel/Matlab all say R^2=15% with intercept=0.

Re: [R] lm without intercept, false R-squared

2012-06-27 Thread Christof Kluß
for example the same model with intercept R² = 0.6, without intercept R² = 0.9 and higher. In my definition of R², R² has to be equal or less without intercept I do not know what R shows, but in the summary of the model without intercept it does not show the R² of the regression line. When I run

Re: [R] lm without intercept, false R-squared

2012-06-27 Thread Gabor Grothendieck
On Wed, Jun 27, 2012 at 4:36 AM, Christof Kluß wrote: > > for example the same model with intercept R² = 0.6, without intercept R² > = 0.9 and higher. In my definition of R², R² has to be equal or less > without intercept > > I do not know what R shows, but in the summary of the model without > in

Re: [R] lm without intercept, false R-squared

2012-06-27 Thread peter dalgaard
On Jun 27, 2012, at 13:15 , Uwe Ligges wrote: > > 1 - crossprod(residuals(model)) / crossprod(y - mean(y)) And the reason why that is not used in R: > y<- rnorm(100,10,1) > x <- 1:100 > model <- lm(y~x-1) > > 1 - crossprod(residuals(model)) / crossprod(y - mean(y)) [,1] [1,] -27.600

Re: [R] lm without intercept, false R-squared

2012-06-27 Thread Uwe Ligges
On 27.06.2012 10:36, Christof Kluß wrote: for example the same model with intercept R² = 0.6, without intercept R² = 0.9 and higher. In my definition of R², R² has to be equal or less without intercept I do not know what R shows, but in the summary of the model without intercept it does not s

Re: [R] lm without intercept, false R-squared

2012-06-27 Thread Christof Kluß
for example the same model with intercept R² = 0.6, without intercept R² = 0.9 and higher. In my definition of R², R² has to be equal or less without intercept I do not know what R shows, but in the summary of the model without intercept it does not show the R² of the regression line. When I run

Re: [R] lm without intercept, false R-squared

2012-06-27 Thread peter dalgaard
On Jun 27, 2012, at 09:33 , Christof Kluß wrote: > Hi > > is there a command that calculates the correct adjusted R-squared, when > I work without intercept? (The R-squared from lm without intercept is > false.) When people say that, they are usually implying that a "correct" R-squared can be

Re: [R] lm without intercept, false R-squared

2012-06-27 Thread Mikko Korpela
On 06/27/2012 10:33 AM, Christof Kluß wrote: > Hi > > is there a command that calculates the correct adjusted R-squared, when > I work without intercept? (The R-squared from lm without intercept is > false.) Hi! This answer in R-FAQ might help you: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Wh

Re: [R] lm without intercept, false R-squared

2012-06-27 Thread Uwe Ligges
On 27.06.2012 09:33, Christof Kluß wrote: Hi is there a command that calculates the correct adjusted R-squared, when I work without intercept? (The R-squared from lm without intercept is false.) Then we need your definition of your version of "correct" - we know the definition of your versi

[R] lm without intercept, false R-squared

2012-06-27 Thread Christof Kluß
Hi is there a command that calculates the correct adjusted R-squared, when I work without intercept? (The R-squared from lm without intercept is false.) Greetings Chrsitof __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-hel

Re: [R] lm without intercept

2011-02-18 Thread Jan
Hi, thanks for your help. I'm beginning to understand things better. > If you plotted your data, you would realize that whether you fit the > 'best' least squares model or one with a zero intercept, the fit is > not going to be very good > Do the data cluster tightly around the dashed line? No, a

Re: [R] lm without intercept

2011-02-18 Thread Jan
Hello Achim, > Not quite. Consult your statistics textbook for the correct interpretation > of p-values. Under the null hypothesis of a true intercept of zero, it is > very likely to observe an intercept as large as 13.52 or larger. thank you for that help. I suppose the net doesn't have a detai

Re: [R] lm without intercept

2011-02-18 Thread Jay Emerson
l post: Message: 135 Date: Fri, 18 Feb 2011 11:49:41 +0100 From: Jan To: "R-help@r-project.org list" Subject: [R] lm without intercept Message-ID: <1298026181.2847.19.camel@jan-laptop> Content-Type: text/plain; charset="UTF-8" Hi, I am not a statistics expert, so I

Re: [R] lm without intercept

2011-02-18 Thread Mike Marchywka
Date: Fri, 18 Feb 2011 12:25:36 +0100 From: achim.zeil...@uibk.ac.at To: jrheinlaen...@gmx.de CC: r-help@r-project.org Subject: Re: [R] lm without intercept On Fri, 18 Feb 2011, Jan wrote: > Hi, > > I am not a statistics expert, so I

Re: [R] lm without intercept

2011-02-18 Thread Dennis Murphy
Hi: On Fri, Feb 18, 2011 at 2:49 AM, Jan wrote: > Hi, > > I am not a statistics expert, so I have this question. A linear model > gives me the following summary: > > Call: > lm(formula = N ~ N_alt) > > Residuals: >Min 1Q Median 3Q Max > -110.30 -35.80 -22.77 38.07 122.76

Re: [R] lm without intercept

2011-02-18 Thread Achim Zeileis
On Fri, 18 Feb 2011, Jan wrote: Hi, I am not a statistics expert, so I have this question. A linear model gives me the following summary: Call: lm(formula = N ~ N_alt) Residuals: Min 1Q Median 3Q Max -110.30 -35.80 -22.77 38.07 122.76 Coefficients: Estima

[R] lm without intercept

2011-02-18 Thread Jan
Hi, I am not a statistics expert, so I have this question. A linear model gives me the following summary: Call: lm(formula = N ~ N_alt) Residuals: Min 1Q Median 3Q Max -110.30 -35.80 -22.77 38.07 122.76 Coefficients: Estimate Std. Error t value Pr(>|t|) (