Learn R Programming

spm (version 1.2.2)

vecv: Variance explained by predictive models based on cross-validation

Description

vecv is used to calculate the variance explained by predictive models based on cross-validation. The vecv is based on the differences between the predicted values for, and the observed values of, validation samples for cross-validation. It measures the proportion of variation in the validation data explained by the predicted values obtained from predictive models based on cross-validation.

Usage

vecv(obs, pred)

Arguments

obs

observation values of validation samples.

pred

prediction values of predictive models for validation samples.

Value

a numeric number.

References

Li, J., 2016. Assessing spatial predictive models in the environmental sciences: accuracy. measures, data variation and variance explained. Environmental Modelling & Software 80 1-8.

Examples

Run this code
# NOT RUN {
set.seed(1234)
x <- sample(1:30, 30)
e <- rnorm(30, 1)
y <- x + e
vecv(x, y)

y <- 0.8 * x + e
vecv(x, y)

# }

Run the code above in your browser using DataLab