BinCounts to InterpolatingFunction
- To: mathgroup at smc.vnet.net
- Subject: [mg109442] BinCounts to InterpolatingFunction
- From: "Kevin J. McCann" <Kevin.McCann at umbc.edu>
- Date: Tue, 27 Apr 2010 04:07:05 -0400 (EDT)
I am using a Markov Chain Monte Carlo (MCMC) approach to evaluate a multidimensional probability density function. The output is a large number of multidimensional points {x1,x2,...,xn}. I can use BinCounts to gather the points into a PDF (after appropriate normalization). I would like to then define a function, p[X_], which is the multidimensional interpolation of the BinCounts output, but I can't figure out how to automate this for an arbitrary number of dimensions. Any ideas? For the 2d case I did the following: tbl = Partition[ Flatten[Table[{xmin + i*\[CapitalDelta]x + \[CapitalDelta]x/2, ymin + j*\[CapitalDelta]y + \[CapitalDelta]y/2, counts[[i + 1, j + 1]]/(\[ScriptCapitalN] \[CapitalDelta]x \ \[CapitalDelta]y)}, {i, 0, nx - 1}, {j, 0, ny - 1}]], 3]; f=Interpolation[tbl] But as you can see, this is not easily extended to higher dimensions. Kevin