dlg_marginal: Marginal density estimation

Description Usage Arguments Details Value References Examples

View source: R/density_estimation.R

Description

Function that estimates a univariate density estimation by local Gaussian approximations, as described in Hufthammer and Tjøstheim (2009).

Usage

1
2
3
4
5
6
dlg_marginal(
  x,
  bw = 1,
  eval_points = seq(quantile(x, 0.01), quantile(x, 0.99), length.out = grid_size),
  grid_size = 15
)

Arguments

x

The data vector.

bw

The bandwidth (a single number).

eval_points

The grid where we want to evaluate the density. Chosen suitably if not provided, with length equal to grid_size.

grid_size

Number of grid points if grid is not provided.

Details

This function is mainly mean to be used as a tool in multivariate analysis as away to obtain the estimate of a univariate (marginal) density function, but it can of course be used in general to estimate univariate densities.

Value

A list including the data set $x, the grid $eval_points, the bandwidth $bw, as well as a matrix of the estimated parameter estimates $par_est and the estimated bivariate density $f_est.

References

Hufthammer, Karl Ove, and Dag Tjøstheim. "Local Gaussian Likelihood and Local Gaussian Correlation" PhD Thesis of Karl Ove Hufthammer, University of Bergen, 2009.

Examples

1
2
  x <- rnorm(100)
  estimate <- dlg_marginal(x, bw = 1, eval_points = -4:4)

hotneim/lg documentation built on May 9, 2020, 7:35 a.m.