IA_tab | R Documentation |
Indexes of agreement
printing function for IA_tab
plotting function for a IA_tab, it requires ‘ggplot2’
IA_tab(obs, sim, object, null.object)
## S3 method for class 'IA_tab'
print(x, ..., digits = 2)
## S3 method for class 'IA_tab'
plot(x, y, ..., type = c("OvsS", "RvsS"))
obs |
vector with observed data |
sim |
vector with simulated data (should be the same length as observed) |
object |
alternative to the previous two arguments. An object of class ‘lm’, ‘nls’, ‘lme’ or ‘nlme’ |
null.object |
optional object which represents the ‘null’ model. It is an intercept-only model by default. (Not used at the moment). |
x |
object of class ‘IA_tab’. |
... |
additional plotting arguments (none use at the moment). |
digits |
number of digits for rounding (default is 2) |
y |
not used at the moment |
type |
either “OvsS” (observed vs. simulated) or “RvsS” (residuals vs. simulated). |
This function returns several indexes that might be useful for interpretation
For objects of class ‘lm’ and ‘nls’
bias: mean(obs - sim)
intercept: intercept of the model obs ~ beta_0 + beta_1 * sim + error
slope: slope of the model obs ~ beta_0 + beta_1 * sim + error
RSS (deviance): residual sum of squares of the previous model
MSE (RSS / n): mean squared error; where n is the number of observations
RMSE: squared root of the previous index
R2.1: R-squared extracted from an ‘lm’ object
R2.2: R-squared computed as the correlation between observed and simulated to the power of 2.
ME: model efficiency
NME: Normalized model efficiency
Corr: correlation between observed and simulated
ConCorr: concordance correlation
For objects of class ‘gls’, ‘gnls’, ‘lme’ or ‘nlme’ there are additional metrics such as:
https://en.wikipedia.org/wiki/Coefficient_of_determination
https://en.wikipedia.org/wiki/Nash-Sutcliffe_model_efficiency_coefficient
https://en.wikipedia.org/wiki/Concordance_correlation_coefficient
IC_tab
require(nlme)
require(ggplot2)
## Fit a simple model and then compute IAs
data(swpg)
#' ## Linear model
fit0 <- lm(lfgr ~ ftsw + I(ftsw^2), data = swpg)
ias0 <- IA_tab(object = fit0)
ias0
## Nonlinear model
fit1 <- nls(lfgr ~ SSblin(ftsw, a, b, xs, c), data = swpg)
ias1 <- IA_tab(object = fit1)
ias1
plot(ias1)
## Linear Mixed Models
data(barley, package = "nlraa")
fit2 <- lme(yield ~ NF + I(NF^2), random = ~ 1 | year, data = barley)
ias2 <- IA_tab(object = fit2)
ias2
## Nonlinear Mixed Model
barleyG <- groupedData(yield ~ NF | year, data = barley)
fit3L <- nlsLMList(yield ~ SSquadp3(NF, a, b, c), data = barleyG)
fit3 <- nlme(fit3L, random = pdDiag(a + b ~ 1))
ias3 <- IA_tab(object = fit3)
ias3
plot(ias3)
## Plotting model
prds <- predict_nlme(fit3, interval = "conf", plevel = 0)
barleyGA <- cbind(barleyG, prds)
ggplot(data = barleyGA, aes(x = NF, y = yield)) +
geom_point() +
geom_line(aes(y = Estimate)) +
geom_ribbon(aes(ymin = Q2.5, ymax = Q97.5),
fill = "purple", alpha = 0.2)
## R2M for model 2
R2M(fit2)
## R2M for model 3
R2M(fit3)
## Using IA_tab without a model
IA_tab(obs = swpg$lfgr, sim = fitted(fit0))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.