The data matrix (or data frame). Must have exactly 2 columns.
eval_points
The grid where the density should be estimated. Must have
exactly 2 columns.
grid_size
If eval_points is not supplied, then the function
will create a suitable grid diagonally through the data, with this many
grid points.
bw
The two bandwidths, a numeric vector of length 2.
est_method
The estimation method, must either be "1par" for estimation
with just the local correlation, or "5par" for a full locally Gaussian fit
with all 5 parameters.
tol
The numerical tolerance to be used in the optimization. Only
applicable in the 1-parameter optimization.
run_checks
Logical. Should sanity checks be run on the arguments?
Useful to disable this when doing cross-validation for example.
marginal_estimates
Provide the marginal estimates here if estimation
method is "5par_marginals_fixed", and the marginal estimates have
already been found. Useful for cross-validation. List with two elements as
returned by dlg_marginal_wrapper.
bw_marginal
Vector of bandwidths used to estimate the marginal
distributions.
Value
A list including the data set $x, the grid
$eval_points, the bandwidths $bw, as well as a matrix of the
estimated parameter estimates $par_est and the estimated bivariate
density $f_est.
Details
This function serves as the backbone in the body of methods concerning local
Gaussian correlation. It takes a bivariate data set, x, and a
bivariate set of grid points eval_points, and returns the bivariate,
locally Gaussian density estimate in these points. We also need a vector of
bandwidths, bw, with two elements, and an estimation method
est_method