Description Usage Arguments Value
View source: R/basicFunctions.R
FlexCoDE Fit Conditional Density Estimation via Regression
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | fitFlexCoDE(
xTrain,
zTrain,
xValidation,
zValidation,
xTest = NULL,
zTest = NULL,
nIMax = min(25, length(zTrain)),
regressionFunction,
regressionFunction.extra = NULL,
system = "Fourier",
deltaGrid = seq(0, 0.45, length.out = 15),
chooseDelta = TRUE,
sharpenGrid = seq(0.01, 10, length.out = 20),
chooseSharpen = FALSE,
zMin = NULL,
zMax = NULL,
n_grid = 1000,
verbose = FALSE
)
|
xTrain |
Covariates x used to train the model (one observation per row) |
zTrain |
Responses z used to train the model (matrix with one column; one observation per row) |
xValidation |
Covariates x used to tune the model (one observation per row; same number of columns as xTrain) |
zValidation |
Responses z used to tune the model (matrix with one column; one observation per row) |
xTest |
Covariates x used to estimate risk of final model (one observation per row; same number of columns as xTrain). Default is NULL |
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.NN, regressionFunction.NW, regressionFunction.SpAM, regressionFunction.Series, regressionFunction.Lasso, regressionFunction.Forest or regressionFunction.XGBoost. Type ?regressionFunction.XX to find out more about method XX. |
regressionFunction.extra |
extra parameters to be sent to regression function; see the regression you want to use to check what are the available parameters. The argument nCores which contains the number of cores to be used for parallel computing. Default is one. |
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? Default is TRUE |
sharpenGrid |
Grid of sharpen parameters alpha. Default value is seq(0.01,10,length.out = 20). |
chooseSharpen |
Should alpha, the parameter to sharpen the final estimate, be chosen? Default is FALSE |
zMin |
Minimum value z assumes. Default is min(zTrain). |
zMax |
Maximum value z assumes. Default is max(zTrain). |
n_grid |
Number of grid points to evaluate estimated densities. Default is 1000 |
verbose |
Should we print what we are doing? Default is FALSE. |
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 |
bestAlpha |
Optimal value of alpha according to validation set |
estimatedRisk |
(If user provides xTest and zTest) Estimated risk (error) according to test set) |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.