# NOT RUN {
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
# Input values, independent variable
input <- 0:4
# Target vector, observed values
target <- c(1.9, 4.1, 5.89, 7.9, 10.01)
# Simple linear regression target across input like target = a * input + b,
# where a and b are coefficients.
model <- lm(target~input)
# Information about the model
summary(model)
# Values predicted by the model
predicted <- predict(model)
# using library ehaGoF for goodness of fit.
library(ehaGoF)
# Goodness of fit - standard deviation ratio (SDR)
gofSDR(target, predicted)
# }
Run the code above in your browser using DataLab