LocDenReg | R Documentation |
Local Fréchet regression for densities with respect to L^2
-Wasserstein distance.
LocDenReg(
xin = NULL,
yin = NULL,
hin = NULL,
qin = NULL,
xout = NULL,
optns = list()
)
xin |
An n by p matrix or a vector of length n if p=1 holding the n observations of the predictor. |
yin |
A matrix or list holding the sample of observations of the response. If |
hin |
A list holding the histograms of the response corresponding to each predictor value in the corresponding row of |
qin |
A matrix or list holding the quantile functions of the response. If |
xout |
An m by p matrix or a vector of length m if p=1 holding the m output predictor values. Default is |
optns |
A list of control parameters specified by |
Available control options are
A vector of length p used as the bandwidth for the Fréchet regression or "CV"
(default), i.e., a data-adaptive selection done by cross-validation.
A character holding the type of kernel functions for local Fréchet regression for densities; "rect"
, "gauss"
, "epan"
, "gausvar"
, "quar"
- default: "gauss"
.
A numeric vector holding the grid on [0,1] quantile functions take value on. Default is an equidistant grid.
A scalar giving the length of qSup
. Default is 201.
A scalar with the lower bound of the support of the distribution. Default is NULL
.
A scalar with the upper bound of the support of the distribution. Default is NULL
.
A 2 by p matrix whose columns contain the bandwidth selection range for each corresponding dimension of the predictor xin
for the case when bwReg
equals "CV"
. Default is NULL
and is automatically chosen by a data-adaptive method.
The bandwidth value used in CreateDensity()
for density estimation; positive numeric - default: determine automatically based on the data-driven bandwidth selector proposed by Sheather and Jones (1991).
The number of support points the kernel density estimation uses in CreateDensity()
; numeric - default: 101.
User defined output grid for the support of kernel density estimation used in CreateDensity()
, it overrides nRegGrid
; numeric - default: NULL
The size of the bin to be used used in CreateDensity()
; numeric - default: diff(range(y))/1000
. It only works when the raw sample is available.
A character holding the type of kernel functions used in CreateDensity()
for density estimation; "rect"
, "gauss"
, "epan"
, "gausvar"
, "quar"
- default: "gauss"
.
logical if we expect the distribution to have infinite support or not, used in CreateDensity()
for density estimation; logical - default: FALSE
FALSE
or a positive value giving the lower threshold of the densities used in CreateDensity()
; default: 0.001 * mean(qin[,ncol(qin)] - qin[,1])
.
A list containing the following components:
xout |
Input |
dout |
A matrix or list holding the output densities corresponding to |
dSup |
A numeric vector giving the domain grid of |
qout |
A matrix holding the quantile functions of the output densities. Each row corresponds to a value in |
qSup |
A numeric vector giving the domain grid of |
xin |
Input |
din |
Densities corresponding to the input |
qin |
Quantile functions corresponding to the input |
optns |
A list of control options used. |
Petersen, A., & Müller, H.-G. (2019). "Fréchet regression for random objects with Euclidean predictors." The Annals of Statistics, 47(2), 691–719.
xin = seq(0,1,0.05)
yin = lapply(xin, function(x) {
rnorm(100, rnorm(1,x + x^2,0.005), 0.05)
})
qSup = seq(0,1,0.02)
xout = seq(0,1,0.1)
res1 <- LocDenReg(xin=xin, yin=yin, xout=xout, optns = list(bwReg = 0.12, qSup = qSup))
plot(res1)
xout <- xin
hin = lapply(yin, function(y) hist(y, breaks = 50))
res2 <- LocDenReg(xin=xin, hin=hin, xout=xout, optns = list(qSup = qSup))
plot(res2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.