Re: [R] Strange R squared, possible error

2011-03-17 Thread Berwin A Turlach
G'day Gabor, On Thu, 17 Mar 2011 20:38:21 -0400 Gabor Grothendieck wrote: > > Or am I missing something? O.k., because the residuals don't add to zero, there may be a non-zero correlation between residuals and fitted values, which messes up the equation at the variance level. > Try it on an ex

Re: [R] Strange R squared, possible error

2011-03-17 Thread Gabor Grothendieck
On Thu, Mar 17, 2011 at 8:22 PM, Berwin A Turlach wrote: > G'day Gabor, > > On Thu, 17 Mar 2011 11:36:38 -0400 > Gabor Grothendieck wrote: > >> The idea is that if you have a positive quantity that can be broken >> down into two nonnegative quantities: X = X1 + X2 then it makes sense >> to ask wh

Re: [R] Strange R squared, possible error

2011-03-17 Thread Berwin A Turlach
G'day Gabor, On Thu, 17 Mar 2011 11:36:38 -0400 Gabor Grothendieck wrote: > The idea is that if you have a positive quantity that can be broken > down into two nonnegative quantities: X = X1 + X2 then it makes sense > to ask what proportion X1 is of X. For example: 10 = 6 + 4 and 6 is > .6 of

Re: [R] Strange R squared, possible error

2011-03-17 Thread derek
Thank you for our reply. It's a pity, that 2 variables defined by different formula have same name. If the variables had been named differently, I wouldn't have problem at all and it looks like it's done on purpose. Because I test a quality of data (performance of collecting data) not a model which

Re: [R] Strange R squared, possible error

2011-03-17 Thread Greg Snow
@r-project.org > Subject: Re: [R] Strange R squared, possible error > > Thats exactly what I would like to do. Any idea on good text? I've > consulted > severel texts, but no one defined R^2 as R^2 = 1 - Sum(R[i]^2) / > Sum((y[i])^2-y*)) still less why to use different formul

Re: [R] Strange R squared, possible error

2011-03-17 Thread derek
Thats exactly what I would like to do. Any idea on good text? I've consulted severel texts, but no one defined R^2 as R^2 = 1 - Sum(R[i]^2) / Sum((y[i])^2-y*)) still less why to use different formulas for similar model or why should be R^2 closer to 1 when y=a*x+0 than in general model y=a*x+b. fr

Re: [R] Strange R squared, possible error

2011-03-17 Thread derek
Yes they are. I had edited the reply, but It didn't help. Correction: 2)I meant zero slope, no zero intercept. -- View this message in context: http://r.789695.n4.nabble.com/Strange-R-squared-possible-error-tp3382818p3384648.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Strange R squared, possible error

2011-03-17 Thread derek
Thank you for your very comprehensible answer. I a priori know that model y=a*x+0 is right and that I can't get x=constant nor y=constant. I'm comparing performance of data gathering in my data set to another data sets in which performance gathering is characterized by R-squared . The data in dat

Re: [R] Strange R squared, possible error

2011-03-17 Thread Gabor Grothendieck
On Wed, Mar 16, 2011 at 3:49 PM, derek wrote: > k=lm(y~x) > summary(k) > returns R^2=0.9994 > > lm(y~x) is supposed to find coef. a anb b in y=a*x+b > > l=lm(y~x+0) > summary(l) > returns R^2=0.9998 > lm(y~x+0) is supposed to find coef. a in y=a*x+b while setting b=0 > > The question is why do I g

Re: [R] Strange R squared, possible error

2011-03-17 Thread Peter Ehlers
On 2011-03-17 02:08, derek wrote: Exuse me, I don't claim R^2 can't be negative. What I say if I get R^2 negative then the data are useless. I know, that what Thomas said is true in general case. But in my special case of data, using nonzero intercept is nonsense, and to get R^2 less than 0.985 i

Re: [R] Strange R squared, possible error

2011-03-17 Thread Hadley Wickham
> 2) I don't want to fit data with linear model of zero intercept. > 3) I dont know if I understand correctly. Im 100% sure the model for my data > should have zero intercept. > The only coordinate which Im 100% sure is correct. If I had measured quality > Y of a same sample X0 number of times I wo

Re: [R] Strange R squared, possible error

2011-03-17 Thread derek
Exuse me, I don't claim R^2 can't be negative. What I say if I get R^2 negative then the data are useless. I know, that what Thomas said is true in general case. But in my special case of data, using nonzero intercept is nonsense, and to get R^2 less than 0.985 is considered poor job (standard R^2>

Re: [R] Strange R squared, possible error

2011-03-16 Thread Bert Gunter
On Wed, Mar 16, 2011 at 4:00 PM, derek wrote: > 1) In my very humble opinion R^2 can't be negative, at least for data for > which it sound to use linear model. !!! Your opinion, humble or not, counts for nothing. Thomas stated a mathematical fact. I suggest you make an effort to understand what h

Re: [R] Strange R squared, possible error

2011-03-16 Thread Ben Bolker
On 11-03-16 07:55 PM, Peter Ehlers wrote: > On 2011-03-16 15:02, Ben Bolker wrote: >> ria.buffalo.edu> writes: >> >>> >>> lm(y~x+0) yields the regression on x without the constant, i.e., y=bx+e, >>> not y = a +e >>> >>> derek gmail.com> >>> Sent by: r-help-bounces r-project.org >>> 03/16/201

Re: [R] Strange R squared, possible error

2011-03-16 Thread derek
1) In my very humble opinion R^2 can't be negative, at least for data for which it sound to use linear model. Or the data would have to be utterly wrong to fit them with linear model. 2) I don't want to fit data with linear model of zero intercept. 3) I dont know if I understand correctly. Im 100%

Re: [R] Strange R squared, possible error

2011-03-16 Thread Peter Ehlers
On 2011-03-16 15:02, Ben Bolker wrote: ria.buffalo.edu> writes: lm(y~x+0) yields the regression on x without the constant, i.e., y=bx+e, not y = a +e derek gmail.com> Sent by: r-help-bounces r-project.org 03/16/2011 03:49 PM Would someone like to (please!) write this up and submi

Re: [R] Strange R squared, possible error

2011-03-16 Thread Ben Bolker
ria.buffalo.edu> writes: > > lm(y~x+0) yields the regression on x without the constant, i.e., y=bx+e, > not y = a +e > > derek gmail.com> > Sent by: r-help-bounces r-project.org > 03/16/2011 03:49 PM > Would someone like to (please!) write this up and submit it to Kurt Hornik for inclu

Re: [R] Strange R squared, possible error

2011-03-16 Thread Thomas Lumley
On Thu, Mar 17, 2011 at 10:01 AM, derek wrote: > It states summary.lm: > > r.squared       R^2, the ‘fraction of variance explained by the model’, > > R^2 = 1 - Sum(R[i]^2) / Sum((y[i]- y*)^2), > > where y* is the mean of y[i] if there is an intercept and zero otherwise. > > Why to use different f

Re: [R] Strange R squared, possible error

2011-03-16 Thread derek
It states summary.lm: r.squared R^2, the ‘fraction of variance explained by the model’, R^2 = 1 - Sum(R[i]^2) / Sum((y[i]- y*)^2), where y* is the mean of y[i] if there is an intercept and zero otherwise. Why to use different formula when intercept is set to zero? I tried to compute R^2

Re: [R] Strange R squared, possible error

2011-03-16 Thread JLucke
lm(y~x+0) yields the regression on x without the constant, i.e., y=bx+e, not y = a +e derek Sent by: r-help-boun...@r-project.org 03/16/2011 03:49 PM To r-help@r-project.org cc Subject [R] Strange R squared, possible error k=lm(y~x) summary(k) returns R^2=0.9994 lm(y~x) is supposed

Re: [R] Strange R squared, possible error

2011-03-16 Thread Bert Gunter
?summary.lm The R^2 section explains that R^2 is computed differently depending on whether or not an intercept is in the model. -- Bert On Wed, Mar 16, 2011 at 12:49 PM, derek wrote: > k=lm(y~x) > summary(k) > returns R^2=0.9994 > > lm(y~x) is supposed to find coef. a anb b in y=a*x+b > > l=lm

Re: [R] Strange R squared, possible error

2011-03-16 Thread Ista Zahn
Hi Derek, R^2 doesn't mean the same thing when you omit the intercept, as has been discussed on this list before. See http://r.789695.n4.nabble.com/lm-without-intercept-td3312429.html Best, Ista On Wed, Mar 16, 2011 at 3:49 PM, derek wrote: > k=lm(y~x) > summary(k) > returns R^2=0.9994 > > lm(y~