| goodness_of_fit {chemdeg} | R Documentation |
Goodness-of-fit, non-linear regression
Description
Function that returns the following goodness-of-fit statistics for non-linear regression: AIC, AICc, BIC, RMSE and reduced Chi-squared.
Usage
goodness_of_fit(fit)
Arguments
fit |
a |
Details
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.
Value
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
chemdegfunctionsAICC()andchiquad_red()for AICc and reduced chi-squared, respectively.
See Also
stats::AIC(), AICC(), stats::BIC(), stats::sigma(),
chiquad_red()
Examples
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)