looCV: Function for conducting leave-one-out cross-validation

View source: R/looCV.R

looCVR Documentation

Function for conducting leave-one-out cross-validation

Description

looCV conducts a leave-one-out cross-validation for parametric and smooth land use regression (LUR) models fitted with the functions parLUR and smoothLUR, respectively.

Usage

looCV(data, x, ID, spVar1, spVar2, y, dirEff, thresh = 0.95)

Arguments

data

A data set which contains the dependent variable and the potential predictors.

x

A character vector stating the variable names of the potential predictors (names have to match the column names of 'data').

ID

A character vector stating the variable name referring to the monitoring sites' ID (name has to mach the column name of 'data').

spVar1

A character vector stating the variable name referring to longitude (name has to match the column name of 'data').

spVar2

A character vector stating the variable name referring to latitude (name has to match the column name of 'data').

y

A character string indicating the name of the dependent variable (name has to match the column name of 'data').

dirEff

A vector that contains one entry for each potential predictor and indicates the expected direction of the effect of the potential predictor (1 for positive, -1 for negative and 0 if the expected effect sign is unclear). Argument is only required for parametric model fitting.

thresh

A numeric value that indicates the maximum share of zero values; if the share is exceeded, the corresponding potential predictor is excluded.

Value

An object of class 'loocvLUR' with the following elements:

df.err

data.frame with four columns: ID (ID of monitoring site), Err.par (Errors derived from parametric LUR model), Err.smooth (Errors derived from smooth LUR model)

ls.models

list with elements according to lines of data set; each list element is named according to the ID of the omitted monitoring site is itself a list containing two elements: mod.par (parametric model based on remaining sites), mod.smooth (smooth model based on remaining sites)

It has '...', '...', and '...' methods.

Author(s)

Svenia Behm and Markus Fritsch

See Also

parLUR for parametric land use regression (LUR) modeling. smoothLUR for smooth land use regression (LUR) modeling. kFoldCV for k-fold cross-validation for parLUR and smoothLUR objects.

Examples

## Load data set
data(monSitesDE, package="smoothLUR")


markusfritsch/smoothLUR documentation built on Nov. 5, 2022, 3:42 p.m.