dlg {lg} | R Documentation |
The locally Gaussian density estimator (LGDE)
Description
Estimate a multivariate density function using locally Gaussian approximations
Usage
dlg(lg_object, grid, level = 0.95, normalization_points = NULL,
bootstrap = F, B = 500)
Arguments
lg_object |
An object of type |
grid |
A matrix of grid points, where we want to evaluate the density estimate. |
level |
Specify a level if asymptotic standard deviations and confidence intervals should be returned. |
normalization_points |
How many grid points for approximating the integral of the density estimate, to use for normalization? |
bootstrap |
Calculate bootstrapped confidence intervals instead. |
B |
Number of bootstrap replications if using bootstrapped confidence intervals. |
Details
This function does multivariate density estimation using the locally Gaussian
density estimator (LGDE), that was introduced by Otneim & Tjøstheim (2017).
The function takes as arguments an lg
-object as produced by the main
lg_main
-function (where all the running parameters are specified), and
a grid of points where the density estimate should be estimated.
Value
A list containing the density estimate as well as all the running parameters that has been used. The elements are:
-
f_est
: The estimated multivariate density. -
loc_mean
: The estimated local means ifest_method
is "5par" or "5par_marginals_fixed", a matrix of zeros ifest_method
is "1par". -
loc_sd
: The estimated local st. deviations ifest_method
is "5par" or "5par_marginals_fixed", a matrix of ones ifest_method
is "1par". -
loc_cor
: Matrix of estimated local correlations, one column for each pair of variables, in the same order as specified in the bandwidth object. -
x
: The data set. -
bw
: The bandwidth object. -
transformed_data
: The data transformed to approximate marginal standard normality. -
normalizing_constants
: The normalizing constants used to transform data and grid back and forth to the marginal standard normality scale, as seen in eq. (8) of Otneim & Tjøstheim (2017). -
grid
: The grid where the estimation was performed, on the original scale. -
transformed_grid
: The grid where the estimation was performed, on the marginal standard normal scale. -
normalization_points
Number of grid points used to approximate the integral of the density estimate, in order to normalize? -
normalization_constant
If approximated, the integral of the non-normalized density estimate. NA if not normalized. -
density_normalized
Logical, indicates whether the final density estimate (contained in f_est) has been approximately normalized to have unit integral. -
loc_cor_sd
Estimated asymptotic standard deviation for the local correlations. -
loc_cor_lower
Lower confidence limit based on the asymptotic standard deviation. -
loc_cor_upper
Upper confidence limit based on the asymptotic standard deviation.
References
Otneim, Håkon, and Dag Tjøstheim. "The locally gaussian density estimator for multivariate data." Statistics and Computing 27, no. 6 (2017): 1595-1616.
Examples
x <- cbind(rnorm(100), rnorm(100), rnorm(100))
lg_object <- lg_main(x) # Put all the running parameters in here.
grid <- cbind(seq(-4, 4, 1), seq(-4, 4, 1), seq(-4, 4, 1))
density_estimate <- dlg(lg_object, grid = grid)