get discrete pdf/pmf from a kernel distribution pdf on an interval
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
AbioEngineer
el 9 de Dic. de 2020
Respondida: Jeff Miller
el 9 de Dic. de 2020
I fit a kernel distribution on some data. Now I want to sample with replacement that same Fitted kernel distribution, on a specific interval, that may be much narrower or broader than the original data I used to fit the kernel.
I can already get the kernel distribution:
X1 = 10 + 5 * randn(200, 1);
myFit1 = fitdist(X1, 'kernel')
and generate some randomly sampled data from it:
numbers = random(myFit, 500, 1);
But how do I specify to sample from a certain range. I don't want to threshold and truncate the numbers after the fact. This might result in different numbers of sampled elements which will cause errors in later applications such as KL divergence.
0 comentarios
Respuesta aceptada
Jeff Miller
el 9 de Dic. de 2020
myFitTrunc = truncate(myFit1,4,12) % 4, 12 are example lower,upper truncation bounds
Y = random(myFitTrunc,500,1)
histogram(Y)
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!