Title: | Boundary Adaptive Local Polynomial Conditional Density Estimator |
---|---|
Description: | Tools for estimation and inference of conditional densities, derivatives and functions. This is the companion software for Cattaneo, Chandak, Jansson and Ma (2024) <doi:10.3150/23-BEJ1711>. |
Authors: | Rajita Chandak [aut, cre] |
Maintainer: | Rajita Chandak <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.5 |
Built: | 2024-11-25 15:22:31 UTC |
Source: | CRAN |
Function to generate unit basis vector according to polynomial order
and derivative order. This function returns unit vector that is the same size
as the vector returned by poly_base(x, p)
.
basis_vec(x, p, mu)
basis_vec(x, p, mu)
x |
Sample input scalar or vector. |
p |
Polynomial order. |
mu |
Derivative order. |
Vector of appropriate length with ones corresponding to entries of order mu
.
basis_vec(x = 2, p = 5, mu = 1)
basis_vec(x = 2, p = 5, mu = 1)
The coef method for local polynomial density bandwidth selection objects.
## S3 method for class 'lpbwcde' coef(object, ...)
## S3 method for class 'lpbwcde' coef(object, ...)
object |
Class "lpbwcde" object, obtained by calling |
... |
Other arguments. |
Matrix |
A matrix containing y_grid points and selected bandwidths. |
Matias D. Cattaneo, Princeton University. [email protected].
Rajita Chandak (maintainer), Princeton University. [email protected].
Michael Jansson, University of California Berkeley. [email protected].
Xinwei Ma, University of California San Diego. [email protected].
lpbwcde
for data-driven bandwidth selection.
Supported methods: coef.lpbwcde
, print.lpbwcde
, summary.lpbwcde
.
n=100 x_data = as.matrix(rnorm(n, mean=0, sd=1)) y_data = as.matrix(rnorm(n, mean=0, sd=1)) y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1))bandwidth selection
y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) model2 = lpcde::lpbwcde(y_data=y_data, x_data=x_data, x=0, y_grid = y_grid, bw_type = "mse-rot") coef(model2)
The coef method for local polynomial conditional density objects.
## S3 method for class 'lpcde' coef(object, ...)
## S3 method for class 'lpcde' coef(object, ...)
object |
Class "lpcde" object, obtained by calling |
... |
Additional options. |
outputs |
A matrix containing the estimates |
Matias D. Cattaneo, Princeton University. [email protected].
Rajita Chandak (maintainer), Princeton University. [email protected]
Michael Jansson, University of California Berkeley. [email protected].
Xinwei Ma, University of California San Diego. [email protected].
lpcde
for local polynomial conditional density estimation.
Supported methods: coef.lpcde
, confint.lpcde
,
plot.lpcde
, print.lpcde
,
summary.lpcde
, vcov.lpcde
n=100 x_data = as.matrix(rnorm(n, mean=0, sd=1)) y_data = as.matrix(rnorm(n, mean=0, sd=1)) y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) # density estimation model1 = lpcde::lpcde(x_data=x_data, y_data=y_data, y_grid=y_grid, x=0, bw=0.5) coef(model1)
n=100 x_data = as.matrix(rnorm(n, mean=0, sd=1)) y_data = as.matrix(rnorm(n, mean=0, sd=1)) y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) # density estimation model1 = lpcde::lpcde(x_data=x_data, y_data=y_data, y_grid=y_grid, x=0, bw=0.5) coef(model1)
The confint method for local polynomial conditional density objects.
## S3 method for class 'lpcde' confint( object, parm = NULL, level = 0.95, CIuniform = FALSE, CIsimul = 2000, ... )
## S3 method for class 'lpcde' confint( object, parm = NULL, level = 0.95, CIuniform = FALSE, CIsimul = 2000, ... )
object |
Class "lpdensity" object, obtained by calling |
parm |
Integer, indicating which parameters are to be given confidence intervals. |
level |
Numeric scalar between 0 and 1, the confidence level for computing confidence intervals/bands. Equivalent to (1-significance level). |
CIuniform |
|
CIsimul |
Positive integer, specifies the number of simulations used to construct critical values (default is |
... |
Additional options, including (i) |
Estimate |
A matrix containing grid points, estimates and confidence interval end points using p- and q-th order local polynomials as well as bias-corrected estimates and corresponding confidence intervals. |
crit_val |
The critical value used in computing the confidence interval end points. |
Matias D. Cattaneo, Princeton University. [email protected].
Rajita Chandak (maintainer), Princeton University. [email protected].
Michael Jansson, University of California Berkeley. [email protected].
Xinwei Ma, University of California San Diego. [email protected].
lpcde
for local polynomial conditional density estimation.
Supported methods: coef.lpcde
, confint.lpcde
,
plot.lpcde
, print.lpcde
,
summary.lpcde
, vcov.lpcde
n=100 x_data = as.matrix(rnorm(n, mean=0, sd=1)) y_data = as.matrix(rnorm(n, mean=0, sd=1)) y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) # density estimation model1 = lpcde::lpcde(x_data=x_data, y_data=y_data, y_grid=y_grid, x=0, bw=0.5) confint(model1)
n=100 x_data = as.matrix(rnorm(n, mean=0, sd=1)) y_data = as.matrix(rnorm(n, mean=0, sd=1)) y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) # density estimation model1 = lpcde::lpcde(x_data=x_data, y_data=y_data, y_grid=y_grid, x=0, bw=0.5) confint(model1)
lpbwcde
implements the bandwidth selection methods for local
polynomial based conditional density (and derivatives) estimation proposed and studied
in (Cattaneo et al. 2024).
Companion command: lpcde
for estimation and robust bias-corrected inference.
Related Stata
and R
packages useful for nonparametric estimation and inference are
available at https://nppackages.github.io/.
lpbwcde( y_data, x_data, x, y_grid = NULL, p = NULL, q = NULL, grid_spacing = "", ng = NULL, mu = NULL, nu = NULL, kernel_type = c("epanechnikov", "triangular", "uniform"), bw_type = c("imse-rot", "mse-rot"), regularize = NULL )
lpbwcde( y_data, x_data, x, y_grid = NULL, p = NULL, q = NULL, grid_spacing = "", ng = NULL, mu = NULL, nu = NULL, kernel_type = c("epanechnikov", "triangular", "uniform"), bw_type = c("imse-rot", "mse-rot"), regularize = NULL )
y_data |
Numeric matrix/data frame, the raw data of independent. |
x_data |
Numeric matrix/data frame, the raw data of covariates. |
x |
Numeric, specifies the evaluation point in the x-direction. Default is median of the dataset. |
y_grid |
Numeric, specifies the grid of evaluation points. When set to default, grid points will be chosen as 0.05-0.95 percentiles of the data, with a step size of 0.05. |
p |
Nonnegative integer, specifies the order of the local polynomial for |
q |
Nonnegative integer, specifies the order of the local polynomial for |
grid_spacing |
String, If equal to "quantile" will generate quantile-spaced grid evaluation points, otherwise will generate equally spaced points. |
ng |
Int, number of grid points to be used in generating bandwidth estimates. |
mu |
Nonnegative integer, specifies the derivative with respect to |
nu |
Nonnegative integer, specifies the derivative with respect to |
kernel_type |
String, specifies the kernel function, should be one of
|
bw_type |
String, specifies the method for data-driven bandwidth selection. This option will be
ignored if |
regularize |
Boolean (default TRUE). Option to regularize bandwidth selection to have atleast 20+max(p, q)+1 datapoints when evaluating the estimator. |
BW |
A matrix containing (1) |
opt |
A list containing options passed to the function. |
Matias D. Cattaneo, Princeton University. [email protected].
Rajita Chandak (maintainer), Princeton University. [email protected].
Michael Jansson, University of California Berkeley. [email protected].
Xinwei Ma, University of California San Diego. [email protected].
Cattaneo MD, Chandak R, Jansson M, Ma X (2024). “Local Polynomial Conditional Density Estimators.” Bernoulli.
Supported methods: coef.lpbwcde
,
print.lpbwcde
, summary.lpbwcde
.
# Generate a random sample set.seed(42); x_data = rnorm(2000) y_data = rnorm(2000, mean=x_data) x = 0 # Construct bandwidth bw1 <- lpbwcde(y_data = y_data, x_data = x_data, x=x, bw_type = "mse-rot") summary(bw1) # Display bandwidths for a subset of y_grid points summary(bw1, y_grid=bw1$BW[2:5, "y_grid"])
# Generate a random sample set.seed(42); x_data = rnorm(2000) y_data = rnorm(2000, mean=x_data) x = 0 # Construct bandwidth bw1 <- lpbwcde(y_data = y_data, x_data = x_data, x=x, bw_type = "mse-rot") summary(bw1) # Display bandwidths for a subset of y_grid points summary(bw1, y_grid=bw1$BW[2:5, "y_grid"])
lpcde
implements the local polynomial regression based
conditional density (and derivatives). The estimator proposed in
(Cattaneo et al. 2024).
Robust bias-corrected inference methods, both pointwise (confidence intervals) and
uniform (confidence bands), are also implemented.
lpcde( x_data, y_data, y_grid = NULL, x = NULL, bw = NULL, p = NULL, q = NULL, p_RBC = NULL, q_RBC = NULL, mu = NULL, nu = NULL, rbc = TRUE, ng = NULL, cov_flag = c("full", "diag", "off"), normalize = FALSE, nonneg = FALSE, grid_spacing = "", kernel_type = c("epanechnikov", "triangular", "uniform"), bw_type = NULL )
lpcde( x_data, y_data, y_grid = NULL, x = NULL, bw = NULL, p = NULL, q = NULL, p_RBC = NULL, q_RBC = NULL, mu = NULL, nu = NULL, rbc = TRUE, ng = NULL, cov_flag = c("full", "diag", "off"), normalize = FALSE, nonneg = FALSE, grid_spacing = "", kernel_type = c("epanechnikov", "triangular", "uniform"), bw_type = NULL )
x_data |
Numeric matrix/data frame, the raw data of covariates. |
y_data |
Numeric matrix/data frame, the raw data of independent. |
y_grid |
Numeric, specifies the grid of evaluation points in the y-direction. When set to default, grid points will be chosen as 0.05-0.95 percentiles of the data, with a step size of 0.05 in y-direction. |
x |
Numeric, specifies the grid of evaluation points in the x-direction. When set to default, the evaluation point will be chosen as the median of the x data. To generate estimates for multiple conditioning values, please loop over the x values and evaluate the lpcde function at each point. |
bw |
Numeric, specifies the bandwidth used for estimation. Can be (1) a positive
scalar (common bandwidth for all grid points); or (2) a positive numeric vector/matrix
specifying bandwidths for each grid point (should be the same dimension as |
p |
Nonnegative integer, specifies the order of the local polynomial for |
q |
Nonnegative integer, specifies the order of the local polynomial for |
p_RBC |
Nonnegative integer, specifies the order of the local polynomial for |
q_RBC |
Nonnegative integer, specifies the order of the local polynomial for |
mu |
Nonnegative integer, specifies the derivative with respect to |
nu |
Nonnegative integer, specifies the derivative with respect to |
rbc |
Boolean. TRUE (default) for rbc calcuations, required for valid uniform inference. |
ng |
Int, number of grid points to be used. generates evenly space points over the support of the data. |
cov_flag |
String, specifies covariance computation. Must be one of "full" (default), "diag" or "off". |
normalize |
Boolean, False (default) returns original estimator, True normalizes estimates to integrate to 1. |
nonneg |
Boolean, False (default) returns original estimator, True returns maximum of estimate and 0. |
grid_spacing |
String, If equal to "quantile" will generate quantile-spaced grid evaluation points, otherwise will generate equally spaced points. |
kernel_type |
String, specifies the kernel function, should be one of
|
bw_type |
String, specifies the method for data-driven bandwidth selection. This option will be
ignored if |
Bias correction is only used for the construction of confidence intervals/bands, but not for point estimation.
The point estimates, denoted by est
, are constructed using local polynomial estimates of order p
and q
,
while the centering of the confidence intervals/bands, denoted by est_RBC
,
are constructed using local polynomial estimates of order
p_RBC
and q_RBC
. The confidence intervals/bands take the form:
[est_RBC - cv * SE(est_RBC) , est_RBC + cv * SE(est_RBC)]
, where cv
denotes
the appropriate critical value and SE(est_RBC)
denotes an standard error estimate for
the centering of the confidence interval/band. As a result, the confidence intervals/bands
may not be centered at the point estimates because they have been bias-corrected.
Setting p_RBC
equal to p
and q_RBC
to q
, results on centered
at the point estimate confidence intervals/bands, but requires undersmoothing for
valid inference (i.e., (I)MSE-optimal bandwdith for the density point estimator cannot
be used). Hence the bandwidth would need to be specified manually when q=p
,
and the point estimates will not be (I)MSE optimal. See Cattaneo, Jansson and Ma
(2020a, 2020b) for details, and also Calonico, Cattaneo, and Farrell (2018, 2020)
for robust bias correction methods.
Sometimes the density point estimates may lie outside
of the confidence intervals/bands, which can happen if the underlying distribution exhibits
high curvature at some evaluation point(s). One possible solution in this case is to
increase the polynomial order p
or to employ a smaller bandwidth.
Estimate |
A matrix containing (1) |
CovMat |
The variance-covariance matrix corresponding to |
opt |
A list containing options passed to the function. |
Matias D. Cattaneo, Princeton University. [email protected].
Rajita Chandak (maintainer), Princeton University. [email protected].
Michael Jansson, University of California Berkeley. [email protected].
Xinwei Ma, University of California San Diego. [email protected].
Cattaneo MD, Chandak R, Jansson M, Ma X (2024).
“Local Polynomial Conditional Density Estimators.”
Bernoulli.
Calonico S, Cattaneo MD, Farrell MH (2018).
“On the Effect of Bias Estimation on Coverage Accuracy in Nonparametric Inference.”
Journal of the American Statistical Association, 113(522), 767–779.
Calonico S, Cattaneo MD, Farrell MH (2022).
“Coverage Error Optimal Confidence Intervals for Local Polynomial Regression.”
Bernoulli, 28(4), 2998–3022.
Cattaneo MD, Jansson M, Ma X (2020).
“Simple local polynomial density estimators.”
J. Amer. Statist. Assoc., 115(531), 1449–1455.
Supported methods: coef.lpcde
, confint.lpcde
,
plot.lpcde
, print.lpcde
,
summary.lpcde
, vcov.lpcde
#Density estimation example n=500 x_data = matrix(rnorm(n, mean=0, sd=1)) y_data = matrix(rnorm(n, mean=x_data, sd=1)) y_grid = seq(from=-1, to=1, length.out=5) model1 = lpcde::lpcde(x_data=x_data, y_data=y_data, y_grid=y_grid, x=0, bw=0.5) #summary of estimation summary(model1)
#Density estimation example n=500 x_data = matrix(rnorm(n, mean=0, sd=1)) y_data = matrix(rnorm(n, mean=x_data, sd=1)) y_grid = seq(from=-1, to=1, length.out=5) model1 = lpcde::lpcde(x_data=x_data, y_data=y_data, y_grid=y_grid, x=0, bw=0.5) #summary of estimation summary(model1)
Generates list of all combinations of length less than or equal to d of numbers that add up to n.
mvec(n, d)
mvec(n, d)
n |
Total value of each combination |
d |
Maximum length of combinations |
The plot method for local polynomial density objects.
A standard ggplot2
object is returned, hence can be used for further customization.
## S3 method for class 'lpcde' plot( ..., alpha = NULL, type = NULL, lty = NULL, lwd = NULL, lcol = NULL, pty = NULL, pwd = NULL, pcol = NULL, y_grid = NULL, CItype = NULL, CIuniform = FALSE, CIsimul = 2000, CIshade = NULL, CIcol = NULL, title = NULL, xlabel = NULL, ylabel = NULL, legendTitle = NULL, legendGroups = NULL, rbc = FALSE )
## S3 method for class 'lpcde' plot( ..., alpha = NULL, type = NULL, lty = NULL, lwd = NULL, lcol = NULL, pty = NULL, pwd = NULL, pcol = NULL, y_grid = NULL, CItype = NULL, CIuniform = FALSE, CIsimul = 2000, CIshade = NULL, CIcol = NULL, title = NULL, xlabel = NULL, ylabel = NULL, legendTitle = NULL, legendGroups = NULL, rbc = FALSE )
... |
Class "lpcde" object, obtained from calling |
alpha |
Numeric scalar between 0 and 1, specifies the significance level for plotting confidence intervals/bands. |
type |
String, one of |
lty |
Line type for point estimates, only effective if |
lwd |
Line width for point estimates, only effective if |
lcol |
Line color for point estimates, only effective if |
pty |
Scatter plot type for point estimates, only effective if |
pwd |
Scatter plot size for point estimates, only effective if |
pcol |
Scatter plot color for point estimates, only effective if |
y_grid |
Numeric vector, specifies a subset of grid points
to plot point estimates. This option is effective only if |
CItype |
String, one of |
CIuniform |
|
CIsimul |
Positive integer, specifies the number of simulations used to construct critical values (default is |
CIshade |
Numeric, specifies the opaqueness of the confidence region, should be between 0 (transparent) and
|
CIcol |
Color of the confidence region. |
title , xlabel , ylabel
|
Strings, specifies the title of the plot and labels for the x- and y-axis. |
legendTitle |
String, specifies the legend title. |
legendGroups |
String vector, specifies the group names used in legend. |
rbc |
|
Figure |
A standard |
Matias D. Cattaneo, Princeton University. [email protected].
Rajita Chandak (maintainer), Princeton University. [email protected]
Michael Jansson, University of California Berkeley. [email protected].
Xinwei Ma, University of California San Diego. [email protected].
lpcde
for local polynomial density estimation.
Supported methods: coef.lpcde
, confint.lpcde
,
plot.lpcde
, print.lpcde
,
summary.lpcde
, vcov.lpcde
Generate polynomial basis vector up to order p.
has multivariate functionality as described in the main paper
normalized by factorials in denominator.
NOTE: currently works only up to 4th degree polynomial expansion for multivariate x
.
poly_base(x, p)
poly_base(x, p)
x |
A number or vector. |
p |
A number (integer). |
Polynomial basis of x
up to degree p
.
poly_base(x = 2, p = 5)
poly_base(x = 2, p = 5)
The print method for local polynomial conditional density bandwidth selection objects.
## S3 method for class 'lpbwcde' print(x, ...)
## S3 method for class 'lpbwcde' print(x, ...)
x |
Class "lpbwcde" object, obtained by calling |
... |
Other arguments. |
Display output |
A list of specified options provided to the function. |
Matias D. Cattaneo, Princeton University. [email protected].
Rajita Chandak (maintainer), Princeton University. [email protected].
Michael Jansson, University of California Berkeley. [email protected].
Xinwei Ma, University of California San Diego. [email protected].
lpbwcde
for data-driven bandwidth selection.
Supported methods: coef.lpbwcde
, print.lpbwcde
, summary.lpbwcde
.
n=100 x_data = as.matrix(rnorm(n, mean=0, sd=1)) y_data = as.matrix(rnorm(n, mean=0, sd=1)) y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) # bandwidth selection y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) model2 = lpcde::lpbwcde(y_data=y_data, x_data=x_data, x=0, y_grid = y_grid, bw_type = "mse-rot") print(model2)
n=100 x_data = as.matrix(rnorm(n, mean=0, sd=1)) y_data = as.matrix(rnorm(n, mean=0, sd=1)) y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) # bandwidth selection y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) model2 = lpcde::lpbwcde(y_data=y_data, x_data=x_data, x=0, y_grid = y_grid, bw_type = "mse-rot") print(model2)
The print method for local polynomial conditional density objects.
## S3 method for class 'lpcde' print(x, ...)
## S3 method for class 'lpcde' print(x, ...)
x |
Class "lpcde" object, obtained from calling |
... |
Additional options. |
Display output |
summary of inputs to |
Matias D. Cattaneo, Princeton University. [email protected].
Rajita Chandak (maintainer), Princeton University. [email protected].
Michael Jansson, University of California Berkeley. [email protected].
Xinwei Ma, University of California San Diego. [email protected].
lpcde
for local polynomial conditional density estimation.
Supported methods: coef.lpcde
, confint.lpcde
,
plot.lpcde
, print.lpcde
,
summary.lpcde
, vcov.lpcde
n=100 x_data = as.matrix(rnorm(n, mean=0, sd=1)) y_data = as.matrix(rnorm(n, mean=0, sd=1)) y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) # density estimation model1 = lpcde::lpcde(x_data=x_data, y_data=y_data, y_grid=y_grid, x=0, bw=0.5) print(model1)
n=100 x_data = as.matrix(rnorm(n, mean=0, sd=1)) y_data = as.matrix(rnorm(n, mean=0, sd=1)) y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) # density estimation model1 = lpcde::lpcde(x_data=x_data, y_data=y_data, y_grid=y_grid, x=0, bw=0.5) print(model1)
The summary method for local polynomial conditional density bandwidth selection objects.
## S3 method for class 'lpbwcde' summary(object, ...)
## S3 method for class 'lpbwcde' summary(object, ...)
object |
Class "lpbwcde" object, obtained by calling |
... |
Additional options, including (i) |
Display output |
A list of specified options and a matrix of grid points, bandwidth, and effective sample size. |
Matias D. Cattaneo, Princeton University. [email protected].
Rajita Chandak (maintainer), Princeton University. [email protected].
Michael Jansson, University of California Berkeley. [email protected].
Xinwei Ma, University of California San Diego. [email protected].
lpbwcde
for data-driven bandwidth selection.
Supported methods: coef.lpbwcde
, print.lpbwcde
, summary.lpbwcde
.
n=100 x_data = as.matrix(rnorm(n, mean=0, sd=1)) y_data = as.matrix(rnorm(n, mean=0, sd=1)) y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) # bandwidth selection y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) model2 = lpcde::lpbwcde(y_data=y_data, x_data=x_data, x=0, y_grid = y_grid, bw_type = "mse-rot") summary(model2)
n=100 x_data = as.matrix(rnorm(n, mean=0, sd=1)) y_data = as.matrix(rnorm(n, mean=0, sd=1)) y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) # bandwidth selection y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) model2 = lpcde::lpbwcde(y_data=y_data, x_data=x_data, x=0, y_grid = y_grid, bw_type = "mse-rot") summary(model2)
The summary method for local polynomial conditional density objects.
## S3 method for class 'lpcde' summary(object, ...)
## S3 method for class 'lpcde' summary(object, ...)
object |
Class "lpcde" object, obtained from calling |
... |
Additional options, including (i) |
Display output |
A list of specified options and a matrix of grid points and estimates. |
Matias D. Cattaneo, Princeton University. [email protected].
Rajita Chandak (maintainer), Princeton University. [email protected]
Michael Jansson, University of California Berkeley. [email protected].
Xinwei Ma, University of California San Diego. [email protected].
lpcde
for local polynomial conditional density estimation.
Supported methods: coef.lpcde
, confint.lpcde
,
plot.lpcde
, print.lpcde
,
summary.lpcde
, vcov.lpcde
n=100 x_data = as.matrix(rnorm(n, mean=0, sd=1)) y_data = as.matrix(rnorm(n, mean=0, sd=1)) y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) # density estimation model1 = lpcde::lpcde(x_data=x_data, y_data=y_data, y_grid=y_grid, x=0, bw=0.5) summary(model1)
n=100 x_data = as.matrix(rnorm(n, mean=0, sd=1)) y_data = as.matrix(rnorm(n, mean=0, sd=1)) y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) # density estimation model1 = lpcde::lpcde(x_data=x_data, y_data=y_data, y_grid=y_grid, x=0, bw=0.5) summary(model1)
The vcov method for local polynomial conditional density objects.
## S3 method for class 'lpcde' vcov(object, ...)
## S3 method for class 'lpcde' vcov(object, ...)
object |
Class "lpdensity" object, obtained by calling |
... |
Additional options. |
Vcov method for local polynomial density conditional estimation
stdErr |
A matrix containing grid points and standard errors using p- and q-th order local polynomials. |
CovMat |
The variance-covariance matrix corresponding to |
CovMat_RBC |
The variance-covariance matrix corresponding to |
Matias D. Cattaneo, Princeton University. [email protected].
Rajita Chandak (maintainer), Princeton University. [email protected].
Michael Jansson, University of California Berkeley. [email protected].
Xinwei Ma, University of California San Diego. [email protected].
lpcde
for local polynomial conditional density estimation.
Supported methods: plot.lpcde
, print.lpcde
,
summary.lpcde
,
n=100 x_data = as.matrix(rnorm(n, mean=0, sd=1)) y_data = as.matrix(rnorm(n, mean=0, sd=1)) y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) # density estimation model1 = lpcde::lpcde(x_data=x_data, y_data=y_data, y_grid=y_grid, x=0, bw=0.5) vcov(model1)
n=100 x_data = as.matrix(rnorm(n, mean=0, sd=1)) y_data = as.matrix(rnorm(n, mean=0, sd=1)) y_grid = stats::quantile(y_data, seq(from=0.1, to=0.9, by=0.1)) # density estimation model1 = lpcde::lpcde(x_data=x_data, y_data=y_data, y_grid=y_grid, x=0, bw=0.5) vcov(model1)