autocart: Create an autocart model

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

Create an autocart model

Usage

1
autocart(response, data, locations, alpha, beta, control = NULL)

Arguments

response

A vector of numeric response values with no NA entries.

data

A dataframe for the predictor variables used in the autocart tree.

locations

A two-column matrix with coordinates for the observations the predictor dataframe.

alpha

A scalar value between 0 and 1 to weight autocorrelation against reduction in variance in the tree splitting. A value of 1 indicates full weighting on measures of autocorrelation.

beta

A scalar value between 0 and 1 to weight the shape of the region in the splitting

control

An object of type "autocartControl" returned by the autocartControl function to control the splitting in the autocart tree.

Value

An S3 object of class "autocart".

Examples

1
2
3
4
5
6
7
8
# Load some data for an autocart example
snow <- na.omit(read.csv(system.file("extdata", "ut2017_snow.csv", package = "autocart")))
y <- snow$yr50[1:40]
X <- data.frame(snow$ELEVATION, snow$MCMT, snow$PPTWT, snow$HUC)[1:40, ]
locations <- as.matrix(cbind(snow$LONGITUDE, snow$LATITUDE))[1:40, ]

# Create an autocart model with 50 trees
snow_model <- autocart(y, X, locations, 0.30, 0)

autocart documentation built on May 27, 2021, 5:07 p.m.