Package BIP :: Package Bayes :: Module Melding
[hide private]
[frames] | no frames]

Module Melding

source code

Classes [hide private]
  Meld
Bayesian Melding class
Functions [hide private]
 
enumRun(model, theta, k) source code
 
model(r, p0, n=1)
Model (r,p0, n=1) Simulates the Population dynamic Model (PDM) Pt = rP0 for n time steps.
source code
 
Run(k)
Run (k) Draw k samples of Theta from its prior distribution, run the model with it and obtain phi = M(theta).
source code
 
KDE(x)
performs a kernel density estimate using the scipy gaussian density if (ll,ul), enforce limits for the distribution's support.
source code
 
Likeli(data, dist, limits, **kwargs)
Generates the likelihood function of data given dist.
source code
 
Filt(cond, x, (ll, ul))
filtering out Out-of-boundary thetas and phis.
source code
 
FiltM(cond, x, limits)
Multiple condition filtering.
source code
 
SIR(alpha, q2phi, limits, q2type, q1theta, phi, L, lik=[])
Sampling Importance Resampling.
source code
 
plotRaHist(arr)
Plots a record array as a panel of histograms
source code
 
main()
testing function
source code
 
main2() source code
Function Details [hide private]

model(r, p0, n=1)

source code 
Model (r,p0, n=1) Simulates the Population dynamic Model (PDM) Pt = rP0 for n time steps. P0 is the initial population size. Example model for testing purposes.

Run(k)

source code 
Run (k) Draw k samples of Theta from its prior distribution, run the model with it and obtain phi = M(theta). For testing purposes only.

KDE(x)

source code 
performs a kernel density estimate using the scipy gaussian density if (ll,ul), enforce limits for the distribution's support. Returns a dictionary.

Likeli(data, dist, limits, **kwargs)

source code 
Generates the likelihood function of data given dist. limits is a tuple setting the interval of the parameter space that will be used as the support for the Likelihood function. returns a vector (1024 elements).

Filt(cond, x, (ll, ul))

source code 
filtering out Out-of-boundary thetas and phis. for single output models. ul and ll are the pre-model boundaries of phi. cond is a vector over which the conditional operations will be applied. x is a vector or matrix of data. matrices are filtered line by line

FiltM(cond, x, limits)

source code 
Multiple condition filtering. for multiple output models cond is an array of condition vectors limits is a list of tuples (ll,ul) with the length of cond

SIR(alpha, q2phi, limits, q2type, q1theta, phi, L, lik=[])

source code 
Sampling Importance Resampling.
Parameters:
  • alpha - pooling weight;
  • q2phi - premodel of phi(tuple of vectors);
  • limits - limits for q2phi (list/tuple of tuples);
  • q2type - dist. type of q2phi (list of strings);
  • q1theta - premodel dists of thetas (tuple);
  • phi - model output (tuple of vectors);
  • L - size of the resample.
  • lik - list of likelihoods available