This function use the local likelihood function proposed by Hjort & Jones (1996) to find an estimate of the local correlation $ρ$ given $n$ bivariate observations and a vector $b$ with the specified bandwidths. Note that the code use the simplifying assumption that the the marginals are standard normal, which reduces the number of parameters to estimate from five to one. This function is based on code from H\aakon Otneim.
A matrix containing the observations, one bivariate observation in each row.
A matrix containing the points where we want to find the local correlations, one bivariate point in each row.
A vector containing the two bandwidhts to use.
Specification of the kernel to use, either
Logical argument, default
In the computation, a product kernel that either is based
on the standard normal distribution or the uniform distribution is
used. The default kernel is the normal one, since it seems to
behave better than the uniform kernel with regard to being able to
get a proper result (i.e. not
NA) and since it also seems to
compute a bit faster when a computation is possible. Note that the
code computes the required densities (related to the normal
distribution) directly instead of using
dmvnorm, since that gives a speed gain.
The result of this function is a list. For each grid-point
there will be an estimate of the local correlation and the
log-density of the corresponding local Gaussian approximation at
that point. When
TRUE, the three
b will also be
Hjort, N. L., and Jones, M. C.: "Locally parametric nonparametric density estimation.", The Annals of Statistics (1996): 1619-1647.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.