Documentation
Dyadic kernel density estimation
DyadicKDE.DyadicKernelDensityEstimator
— TypeComposite type to represent a dyadic kernel density estimator.
DyadicKDE.DyadicKernelDensityEstimator
— MethodDyadicKernelDensityEstimator(kernel_name, bandwidth, significance_level,
n_resample, sdp_solver, evals, W, meta)
Construct a dyadic kernel density estimator.
Arguments
kernel_name::String
: which kernel to use.bandwidth::Float64
: the bandwidth for the estimator.significance_level::Float64
: for the confidence band/intervals.n_resample::Int
: the number of resamples used to construct the confidence band/intervals.sdp_solver::String
: semi-definite program solver.evals::Vector{Float64}
: points at which to evaluate the density estimator.W::UpperTriangular{Float64}
: array of dyadic data.meta::Dict
: any extra information to pass to the estimator.
Base.Multimedia.display
— Methoddisplay(est::DyadicKernelDensityEstimator)
Display a dyadic kernel density estimator.
DyadicKDE.estimate_ROT_bandwidth
— Methodestimate_ROT_bandwidth(W::UpperTriangular{Float64},
kernel_name::String)
Estimate a rule-of-thumb bandwidth from dyadic data.
DyadicKDE.fit
— Methodfit(est::DyadicKernelDensityEstimator)
Fit a dyadic kernel density estimator to data.
Counterfactual dyadic kernel density estimation
DyadicKDE.CounterfactualDyadicKernelDensityEstimator
— TypeComposite type to represent a counterfactual dyadic kernel density estimator.
DyadicKDE.CounterfactualDyadicKernelDensityEstimator
— MethodCounterfactualDyadicKernelDensityEstimator(kernel_name, bandwidth, significance_level,
n_resample, sdp_solver, evals,
W, X0, X1, meta)
Construct a counterfactual dyadic kernel density estimator.
Arguments
kernel_name::String
: which kernel to use.bandwidth::Float64
: the bandwidth for the estimator.significance_level::Float64
: for the confidence band/intervals.n_resample::Int
: the number of resamples used to construct the confidence band/intervals.sdp_solver::String
: semi-definite program solver.evals::Vector{Float64}
: points at which to evaluate the density estimator.W::UpperTriangular{Float64}
: array of treated dyadic data.X0::Vector{Int}
: categorical vector of untreated covariates.X1::Vector{Int}
: categorical vector of treated covariates.meta::Dict
: any extra information to pass to the estimator.
DyadicKDE.ParametricCounterfactualDyadicKernelDensityEstimator
— TypeComposite type to represent a counterfactual dyadic kernel density estimator.
DyadicKDE.ParametricCounterfactualDyadicKernelDensityEstimator
— MethodParametricCounterfactualDyadicKernelDensityEstimator(kernel_name, bandwidth, significance_level,
n_resample, sdp_solver, evals,
W, X0, X1, meta)
Construct a parametric counterfactual dyadic kernel density estimator.
Arguments
kernel_name::String
: which kernel to use.bandwidth::Float64
: the bandwidth for the estimator.significance_level::Float64
: for the confidence band/intervals.n_resample::Int
: the number of resamples used to construct the confidence band/intervals.sdp_solver::String
: semi-definite program solver.evals::Vector{Float64}
: points at which to evaluate the density estimator.W::UpperTriangular{Float64}
: array of treated dyadic data.X0::Vector{Int}
: categorical vector of untreated covariates.X1::Vector{Int}
: categorical vector of treated covariates.phat0::Vector{Float64}
: vector of precomputed parametric untreated covariate estimates.phat1::Vector{Float64}
: vector of precomputed parametric treated covariate estimates.meta::Dict
: any extra information to pass to the estimator.
Base.Multimedia.display
— Methoddisplay(est::CounterfactualDyadicKernelDensityEstimator)
Display a counterfactual dyadic kernel density estimator.
Base.Multimedia.display
— Methoddisplay(est::ParametricCounterfactualDyadicKernelDensityEstimator)
Display a parametric counterfactual dyadic kernel density estimator.
DyadicKDE.fit
— Methodfit(est::CounterfactualDyadicKernelDensityEstimator)
Fit a counterfactual dyadic kernel density estimator to data.
DyadicKDE.fit
— Methodfit(est::ParametricCounterfactualDyadicKernelDensityEstimator)
Fit a parametric counterfactual dyadic kernel density estimator to data.
Helper functions
DyadicKDE.get_RIMSE
— Methodget_RIMSE(fhat::Vector{Float64}, f::Vector{Float64})
Compute the root integrated mean squared error of an estimate for a function.
DyadicKDE.get_average_width
— Methodget_average_width(cb::Matrix{Float64})
Return the average width of a confidence band.
DyadicKDE.get_coverage
— Methodget_coverage(cb::Matrix{Float64}, f::Vector{Float64})
Check if a confidence band covers the true density function.
DyadicKDE.get_f
— Methodget_f(p::Vector{Float64}, evals::Vector{Float64})
Get the true density function from example dyadic Gaussian mixture data.
DyadicKDE.make_dyadic_data
— Methodmake_dyadic_data(n_data::Int, p::Vector{Float64})
Generate some example dyadic data using a Gaussian mixture model.
DyadicKDE.mean
— Methodmean(x::Vector{<:Number})
Compute the mean of a vector of numbers.
DyadicKDE.phi
— Methodphi(t::Real)
Compute the standard normal density function.