I have the following set of x
and y
values:
x = c(1:150)
y = x^-.5 * 155 + (runif(length(x), min=-3, max=3))
And run a linear regression on the data:
plot(x, y, log="xy", cex=.5)
model = lm(log(y) ~ log(x))
model
Now I'd like to have a measure for the quality of the regression and was told that people usually use R^2 ('Coefficient of determination'), which should be close to one.
How can I easily calculate the value in R? I've seen that residuals etc. are already calculated.