Given random variables (X,Y)
which are dependent, the fact that I know the distribution of X ~ N(0.05, 0.0057)
and the given data from experiments ((x1, y1), ..., (x100,y100)
I estimated a bandwidth and the conditional density f(Y|X=x)
via kernel regression. I now want to generate samples of X
using x_sample = rnorm(n, mean=0.05, sd=0.0057)
and calculate the conditional density for that sample (meaning: f(Y|X=x_sample)
). I evaluate the kernel regression on my datapoints (y1, ..., y100)
to get a pointwise density for that given X=x_sample
(via
f_hat = function(u, v){ (sum(K(abs(u-data$x)/H_n) * (K(abs(v-data$y)/h_n)))) / (h_n * sum(K(abs(u-data$x)/H_n))) }
with H_n
and h_n
being the bandwidths, data$x, data$y
being my data and K(u)
being the gaussian kernel).
See: Picture of the pointwise estimated density for a sampled X=x
My Question now: How can I sample a big amount of y
given X=x_sample
? I need this data to afterwards estimate the distribution of Y
.
Aucun commentaire:
Enregistrer un commentaire