Hello,
I was wondering if there is a method to get a conditional distribution out of a multivariate kde in julia, preferably using the package KernelDensityEstimate.jl.
So say for example that I have the following code:
using KernelDensityEstimate, Distributions
# define number of samples
const n_samples = 500
# define two correlated variables
const x = randn(n_samples)
const y = x.^2 .+ rand(Uniform(-0.0005, 0.0005), n_samples)
# and an uncorrelated one
const z = rand(Gamma(), n_samples);
# fit the kde
kde = kde!(Array((hcat(x,y,z)')))
And I would like to get the distribution of x and y conditioned to, say, z = 10.0.
It would be ok for me if the solution uses a multivariate KDEs package different from KernelDensityEstimate.jl, as long as it implements a rand
function.
Thank you very much