fitFlexCoDEKernel: FlexCoDE Fit Conditional Density Estimation via Regression

Description Usage Arguments Value

View source: R/basicFunctionsKernel.R

Description

FlexCoDE Fit Conditional Density Estimation via Regression

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
fitFlexCoDEKernel(
  kernelTrainTrain,
  zTrain,
  kernelValidationTrain,
  zValidation,
  kernelTestTrain = NULL,
  zTest = NULL,
  nIMax = min(25, length(zTrain)),
  regressionFunction,
  regressionFunction.extra = NULL,
  system = "Fourier",
  deltaGrid = seq(0, 0.4, 0.05),
  chooseDelta = TRUE,
  verbose = TRUE
)

Arguments

zTrain

Responses z used to train the model (matrix with one column; one observation per row)

zValidation

Responses z used to tune the model (matrix with one column; one observation per row)

zTest

Responses z used to estimate risk of final model (matrix with one column; one observation per row). Default is NULL

nIMax

Maximum possible number of components of the series expansion (that is, the function will find the best I<nIMax). Default is 100

regressionFunction

a function indicating which regression method will be used to estimate the expansion coefficients. Currently can be one of

regressionFunction.extra

extra parameters to be sent to regression function; see the regression you want to use to check what are the available parameters

system

Basis for z. Current options are "Fourier", "Cosine" and "discrete". Default is "Fourier"

deltaGrid

Grid of threshold deltas (betwen 0 and 0.5). Default value is seq(0,0.4,0.05).

chooseDelta

Should delta, the cutoff to remove spurious bumps, be chosen?

verbose

Should we print what we are doing? Default is TRUE.

xTrain

Covariates x used to train the model (one observation per row)

xValidation

Covariates x used to tune the model (one observation per row; same number of columns as xTrain)

xTest

Covariates x used to estimate risk of final model (one observation per row; same number of columns as xTrain). Default is NULL

Value

Returns the fitted estimated conditional density, and object of the class FlexCoDE. The return value is an object with the following components:

zMin, zMax

Minimum and maximum value of z

nIMax

Maximum number of expansion coefficients (user input). Default is minimum between 25 and number of training samples.

system

Basis used for expanding the response

zTrain

zTrain (user input)

xTrain

xTrain (user input)

regressionObject

Object with fitted regressions. Class and content depend on which regression method was chosen by user

errors

Estimated errors for each value of I (number of expansion coefficients) using validation set

bestI

Optimal number of I according to validation set

bestError

Estimated error of model with bestI expansion terms according to validation set

bestDelta

Optimal value of threshold delta according to validation set

estimatedRisk

(If user provides xTest and zTest) Estimated risk (error) according to test set)


rizbicki/FlexCoDE documentation built on Feb. 10, 2022, 3:14 p.m.