Learn R Programming

DSWE (version 1.8.2)

AMK: Additive Multiplicative Kernel Regression

Description

An additive multiplicative kernel regression based on Lee et al. (2015).

Usage

AMK(
  trainX,
  trainY,
  testX,
  bw = "dpi_gap",
  nMultiCov = 3,
  fixedCov = c(1, 2),
  cirCov = NA
)

Value

a numeric vector for predictions at the data points in testX.

Arguments

trainX

a matrix or dataframe of input variable values in the training dataset.

trainY

a numeric vector for response values in the training dataset.

testX

a matrix or dataframe of test input variable values to compute predictions.

bw

a numeric vector or a character input for bandwidth. If character, bandwidth computed internally; the input should be either 'dpi' or 'dpi_gap'. Default is 'dpi_gap'. See details for more information.

nMultiCov

an integer or a character input specifying the number of multiplicative covariates in each additive term. Default is 3 (same as Lee et al., 2015). The character inputs can be: 'all' for a completely multiplicative model, or 'none' for a completely additive model. Ignored if the number of covariates is 1.

fixedCov

an integer vector specifying the fixed covariates column number(s), default value is c(1,2). Ignored if nMultiCov is set to 'all' or 'none' or if the number of covariates is less than 3.

cirCov

an integer vector specifying the circular covariates column number(s) in trainX, default value is NA.

Details

This function is based on Lee et al. (2015). Main features are:

  • Flexible number of multiplicative covariates in each additive term, which can be set using nMultiCov.

  • Flexible number and columns for fixed covariates, which can be set using fixedCov. The default option c(1,2) sets the first two columns as fixed covariates in each additive term.

  • Handling the data with gaps when the direct plug-in estimator used in Lee et al. fails to return a finite bandwidth. This is set using the option bw = 'dpi_gap' for bandwidth estimation.

References

Lee, Ding, Genton, and Xie, 2015, “Power curve estimation with multivariate environmental factors for inland and offshore wind farms,” Journal of the American Statistical Association, Vol. 110, pp. 56-67, tools:::Rd_expr_doi("10.1080/01621459.2014.977385").

Examples

Run this code
data = data1
trainX = as.matrix(data[c(1:100),2])
trainY = data[c(1:100),7]
testX = as.matrix(data[c(101:110),2])
AMK_prediction = AMK(trainX, trainY, testX, bw = 'dpi_gap', cirCov = NA)

Run the code above in your browser using DataLab