API Reference
LocalPoly.LocalPoly — ModuleLocalPoly.𝐶 — ConstantDict containing the constant $C_{\nu , p}(K)$ used for the plugin bandwidth
LocalPoly.allmultiexponents — Methodallmultiexponents(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)LocalPoly.confint — Methodconfint(grid; ν, p, a, α, kernel, hpilot, h)
Generate a confindence interval.
LocalPoly.gridnodes — Methodgridnodes(g)
Access nodes of gridded data.
LocalPoly.gridsteps — Methodgridsteps(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 }$
LocalPoly.linear_binning! — Methodlinear_binning!(grid, X, y)
Linear binning algorithm for fast computation.
LocalPoly.linear_binning — Methodlinear_binning(X, y; nbins)
Linear binning algorithm for fast computation.
LocalPoly.lpreg! — Methodlpreg!(𝐑, v; kernel, h)
Local polynomial regression, modifying a LPGridModel.
LocalPoly.lpreg — Methodlpreg(y, x; degree, nbins, kernel, h)
Local polynomial regression, constructing a LPGridModel from the data.
LocalPoly.outerproduct! — Methodouterproduct!(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 6LocalPoly.outerproduct — Methodouterproduct(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 6LocalPoly.padκ! — Methodpadκ!(κᶻ::Array{T, N}, κ::Array{T, N}, tmp::Array{T, N}) where {T, N}Zero-pad and shift the convolution kernel, modifying κᶻ in-place.
LocalPoly.padκ — Methodpadκ(κ::Array{T, N}, tmp::Array{T, N}) where {T, N}Zero-pad and shift the convolution kernel.
LocalPoly.plugin_bandwidth — Methodplugin_bandwidth(
x::AbstractArray{T<:Real, 1},
y::AbstractArray{T<:Real, 1};
ν,
p,
kernel,
W
) -> Any
Estimate the rule-of-thumb plugin bandwidth.
LocalPoly.polybasis_grid — Methodpolybasis_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.375LocalPoly.togridindex — Methodtogridindex(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.071067811865476LocalPoly.togridindex — Methodtogridindex(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