View source: R/nls_indicators.R
goodness_of_fit | R Documentation |
Function that returns the following goodness-of-fit statistics for non-linear regression: AIC, AICc, BIC, RMSE and reduced Chi-squared.
goodness_of_fit(fit)
fit |
a |
The function returns the values of AIC, AICC, BIC, RMSE and reduced
chi-squared (\chi^2_{red}
) for nls
objects. If a linear model
object is passed, the function returns its summary.
Given an ord_res
object (output of the function det_order()
),
the function returns one of the results
above depending on the model chosen to explain the data.
Because the chiquad_red()
function returns the value only with weighted
data, the \chi^2_{red}
will be returned only with weighted
regressions.
It returns a table with the values of AIC, AICc, BIC, RSME and reduced Chi squared. Single goodness-of-fit measures can be obtained as follows:
call standard R functions stats::AIC()
, stats::BIC()
,
stats::sigma()
for AIC, BIC and RMSE, respectively;
call chemdeg
functions AICC()
and chiquad_red()
for AICc and
reduced chi-squared, respectively.
stats::AIC()
, AICC()
, stats::BIC()
, stats::sigma()
,
chiquad_red()
x <- c(1, 2, 3, 4, 5)
y <- c(1.2, 3.9, 8.6, 17.4, 26)
er <- c(0.5, 0.8, 0.5, 1.9, 1.2)
fit1 <- nls(y ~ k * x^2,
data = list(x = x, y = y), start = list(k = 1),
weights = 1 / er^2
)
goodness_of_fit(fit1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.