[R] why my R^2 is so small while there do seem to be a dependency there?

Rui Barradas ruipbarradas at sapo.pt
Sun Aug 4 22:41:28 CEST 2013


Hello,

Hoe did you get 0.002? Can you ?dput your data?

d <- read.table(text = "
factor  observation
-0.003       -2
-0.002       -2
-0.001       -1
0.000         1
0.001         0
0.002         1
0.003         2
", header = TRUE)

fit <- lm(observation ~ 0 + factor, data = d)
summary(fit)  # R2 is 0.8595, not 0.002

Hope this helps,

Rui Barradas

Em 04-08-2013 18:19, CHEN, Cheng escreveu:
> Hi gurus!
>
> What I need to do is to find a model, which can predict what the *
> observation* should look like given a *factor* input.
>
> i am doing a simple linear fit in R:
>
> lm(observation~0+factor, data=d), the R^2 is 0.002, which is really small.
>
> however, when I do a 'SELECT AVG observation by 0.001 BRACKET factor',
> there result is something like:
>
> *factor* | *average observersion*
>
> -0.003       -2
>
> -0.002       -2
>
> -0.001       -1
>
> 0.000         1
>
> 0.001         0
>
> 0.002         1
> 0.003         2
>
>
> from a user perspective, i definitely see a pattern here, but somehow this
> pattern is not captured by a linear model. Is my understanding correct?
>
> so R gurus, which model do you suggest me to try for such data?
>
> Thanks!
>
>



More information about the R-help mailing list