Learn R Programming

BayesianTools (version 0.1.1)

GOF: Standard GOF metrics

Description

Startvalues for sampling with nrChains > 1 : if you want to provide different start values for the different chains, provide a list

Usage

GOF(observed, predicted, plot = F)

Arguments

observed
observed values
predicted
predicted values
plot
should a plot be created

Value

A list with the following entries: rmse = root mean squared error, mae = mean absolute error, slope = slope of regression, offset = intercept of regression, R2 = R2 of regression

Details

The function considers predicted ~ observed and calculates

1) rmse = root mean squared error 2) mae = mean absolute errorr 3) a linear regression with slope, intercept and coefficient of determination R2

For the linear regression, the x axis is centered, meaning that the intercept is the difference between observed / predicted for the MEAN predicted value. This setting avoids a correlation between slope and intercept (that the intercept is != 0 as soon as the slope is !=0)

Examples

Run this code

x = runif(500,-1,1)
y = 0.2 + 0.9  *x + rnorm(500, sd = 0.5)

summary(lm(y ~ x))

GOF(x,y)

GOF(x,y, plot = TRUE)

Run the code above in your browser using DataLab