sandwich.cv: Perform _k_-fold cross validation

View source: R/sandwich.cv.r

sandwich.cvR Documentation

Perform k-fold cross validation

Description

Perform k-fold cross validation to evaluate the overall model accuracy and output the average root mean square error (RMSE).

Usage

sandwich.cv(object,
       sampling.attr,
       k=10,
       type="shp",
       ssh.id.col=NULL,
       reporting.id.col=NULL,
       ssh.weights=NULL)

Arguments

object

When type="shp", object is a list of three sf objects generated by load.data.shp, including a point sf object used as the sampling layer, a polygon sf object used as the SSH layer, and a polygon sf object used as the SSH layer. When type="txt", object is a list of two data frames generated by load.data.txt, including a file linking sampling and SSH layers and a file linking reporting and SSH layers.

sampling.attr

Text for the name of the attribute to be interpolated in the sampling layer.

k

Number of folds (k > 1). By default, k = 10.

type

Text for the type of input data. type="shp" denotes shapefiles, and type="txt" denotes text files. By default, type="shp".

ssh.id.col

Text for the column that specifies which stratum each sampling unit falls into (see load.data.txt). Set to NULL when type="shp".

reporting.id.col

Text for the column that specifies which reporting unit each sampling unit falls into (see load.data.txt). Set to NULL when type="shp".

ssh.weights

A list that specifies the strata in the SSH layer and their corresponding columns of weights in reporting_ssh.file (see load.data.txt).

Value

A value of the k-fold cross validation estimate.

See Also

load.data.shp, load.data.txt


sandwichr documentation built on April 27, 2023, 1:10 a.m.