View source: R/aanalyse_kinetics_helpers.R
| compute_diagnostics | R Documentation |
Compute model diagnostics
compute_diagnostics(x, t, fitted, n_params = 1L, env = rlang::caller_env())
x |
A numeric vector of the response variable. |
t |
An optional numeric vector of the predictor variable (e.g. time).
Default is |
fitted |
A numeric vector of the predicted values. |
n_params |
Integer; total number of estimated coefficients in the
model (default |
env |
The calling environment or a defused call, used to report errors and warnings as coming from the user-facing function rather than the validator. |
Squared Pearson correlation between observed and fitted values. Equals
the classic 1 - SSres / SStot for OLS linear fits (matches
summary(lm)$r.squared); a bounded [0, 1] pseudo-R^2 for non-linear
fits such as "monoexponential" and "sigmoidal".
Adjusted R^2 penalised by n_params. Appropriate for OLS linear models;
interpret with caution for non-linear fits.
Information criteria derived from a Gaussian log-likelihood with the
maximum-likelihood residual variance sigma_hat^2 = SSres / n_obs. The
effective parameter count is k = n_params + 1 (the +1 accounts for
the estimated residual variance). Values match stats::AIC() and
stats::BIC() for lm and nls fits. aicc is the small-sample
correction and is NA when n_obs - k - 1 <= 0.
A 1-row data.frame with columns n_obs, n_params, r2,
adj_r2, rmse, cv_rmse, snr, aic, aicc, and bic.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.