I am fitting a simple regression model on my data and I am using nls()
the only problem is it does not provide the coefficient of determination $R^2$ and adjusted $R^2$.
My question is how can I calculate both of $R^2$ and adjusted $R^2$.
The data and codes are
# generate data
beta <- 0.012
n <- 300
Data<- data.frame(y = exp(beta * seq(n)) + rnorm(n), x = seq(n))
# plot data
plot(Data$x, Data$y)
# fit non-linear model
mod <- nls(y ~ exp(a + b * x), data = Data, start = list(a = 0, b = 0))
# add fitted curve
lines(Data$x, predict(mod, list(x = Data$x)))