How to generate random samples for a custom probability density function
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am using 'fmincon' and 'patternsearch' of the OptimizationToolbox, R2016a. My ObjectiveFunction involves estimating the mean and variance of many arbitrary pdfs that are 1) not necessarily integrating to 1, and 2) generated in realtime by other custom functions I wrote so that the pdfs are numerically approximated rather than having any explicit analytical expression. In other words, each pdf is merely expressed as a vector 'likelihood' as a function of x, and the shape/expression of the pdf is unknown and changes as other parameters in the ObjectiveFunction vary across iterations. So I guess I should generate random samples for each pdf and estimate the stats based on these samples. However, I need the sampling to be done as fast as possible because I might need >10000 samples each time.
0 comentarios
Respuestas (1)
Alan Weiss
el 29 de Mzo. de 2016
I think that the first thing you need to do is scale your likelihood so that it becomes a real pdf that integrates to 1. You can call integral for that purpose. Then I suggest that, instead of taking random samples, you numerically integrate moments of your newly-made pdf to find the mean and variance.
Alan Weiss
MATLAB mathematical toolbox documentation
1 comentario
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!