API Reference

LocalPoly.𝐶Constant

Dict containing the constant $C_{\nu , p}(K)$ used for the plugin bandwidth

source
LocalPoly.allmultiexponentsMethod
allmultiexponents(N, degree)

All results of Combinatorics.multiexponents(N, p) for p ≤ degree.

Examples

julia> multiexponents(2, 0) |> collect
1-element Vector{Any}:
 [0, 0]

julia> multiexponents(2, 1) |> collect
2-element Vector{Any}:
 [1, 0]
 [0, 1]

julia> multiexponents(2, 2) |> collect
3-element Vector{Any}:
 [2, 0]
 [1, 1]
 [0, 2]

julia> allmultiexponents(2, 2)
6-element Vector{Tuple{Int64, Int64}}:
 (0, 0)
 (1, 0)
 (0, 1)
 (2, 0)
 (1, 1)
 (0, 2)
source
LocalPoly.gridstepsMethod
gridsteps(g, h, τ)

Compute the number of grid steps for which kernel weights are non-zero. g should be a StepRange.

$L = min { ⌊τδ/h⌋, M-1 }$

source
LocalPoly.lpreg!Method
lpreg!(𝐑, v; kernel, h)

Local polynomial regression, modifying a LPGridModel.

source
LocalPoly.lpregMethod
lpreg(y, x; degree, nbins, kernel, h)

Local polynomial regression, constructing a LPGridModel from the data.

source
LocalPoly.outerproduct!Method
outerproduct!(A::Array{T, N}, xs) where {T, N}

Compute the N-dimensional outer product of the vectors xs, modifying A in-place.

Examples

julia> xs = ([0, 1, 2], [1, 2, 3])
([0, 1, 2], [1, 2, 3])

julia> A = xs[1] * xs[2]'
3×3 Matrix{Int64}:
 0  0  0
 1  2  3
 2  4  6

julia> fill!(A, 0)
3×3 Matrix{Int64}:
 0  0  0
 0  0  0
 0  0  0

julia> outerproduct!(A, xs)
3×3 Matrix{Int64}:
 0  0  0
 1  2  3
 2  4  6
source
LocalPoly.outerproductMethod
outerproduct(xs::NTuple{N, T}) where {N, T}

Compute the N-dimensional outer product of the vectors xs

Examples

julia> xs = ([0, 1, 2], [1, 2, 3])
([0, 1, 2], [1, 2, 3])

julia> xs[1] * xs[2]'
3×3 Matrix{Int64}:
 0  0  0
 1  2  3
 2  4  6

julia> outerproduct(xs)
3×3 Matrix{Int64}:
 0  0  0
 1  2  3
 2  4  6
source
LocalPoly.padκ!Method
padκ!(κᶻ::Array{T, N}, κ::Array{T, N}, tmp::Array{T, N}) where {T, N}

Zero-pad and shift the convolution kernel, modifying κᶻ in-place.

source
LocalPoly.padκMethod
padκ(κ::Array{T, N}, tmp::Array{T, N}) where {T, N}

Zero-pad and shift the convolution kernel.

source
LocalPoly.plugin_bandwidthMethod
plugin_bandwidth(
    x::AbstractArray{T<:Real, 1},
    y::AbstractArray{T<:Real, 1};
    ν,
    p,
    kernel,
    W
) -> Any

Estimate the rule-of-thumb plugin bandwidth.

source
LocalPoly.polybasis_gridMethod
polybasis_grid(L, δ, p)

Construct a polynomial basis of L steps of length delta and degree p.

$A[i, j] = ((j - (size(A, 2) ÷ 2 + 1)) * δ)^(i-1)$

Examples

julia> polybasis_grid(3, 0.5, 3)
4×7 Matrix{Float64}:
  1.0     1.0   1.0     1.0  1.0    1.0  1.0
 -1.5    -1.0  -0.5    -0.0  0.5    1.0  1.5
  2.25    1.0   0.25    0.0  0.25   1.0  2.25
 -3.375  -1.0  -0.125  -0.0  0.125  1.0  3.375
source
LocalPoly.togridindexMethod
togridindex(x, gmin, δ) = 1 + (x - gmin)/δ

Transform the value x to an index into a grid with minimum gmin and step length δ.

Examples

julia> g = 0:0.1:1
0.0:0.1:1.0

julia> gmin = minimum(g)
0.0

julia> δ = step(g)
0.1

julia> i = togridindex(0.5, gmin, δ)
6.0

julia> collect(g)[Int(i)] == 0.5
true

julia> fractional_index = togridindex(2^(-1/2), gmin, δ)
8.071067811865476
source
LocalPoly.togridindexMethod
togridindex(x, g::AbstractRange)

Transform the value x to an index into the range g. This method is ~3 times slower than the direct method, so repeated calls should pre-compute the range minimum and step.

Examples

julia> g = 0:0.1:1
0.0:0.1:1.0

julia> i = togridindex(0.5, g)
6.0

julia> collect(g)[Int(i)] == 0.5
true

julia> fractional_index = togridindex(2^(-1/2), gmin, δ)
8.071067811865476
source