pathSampler - Path-sampling marginal likelihood estimation
| filename : | String (pass by value) |
| The filename where the likelihood samples are stored in. | |
| powerColumnName : | String (pass by value) |
| The name of the column that holds the values of the powers. | |
| likelihoodColumnName : | String (pass by value) |
| The name of the column that holds the likelihood values. | |
| separator : | String (pass by value) |
| The field separator character. Values on each line of the file are separated by this character. If sep = "" the separator is 'white space', that is one or more spaces, tabs, newlines or carriage returns. |
# Create a simple model (unclamped)
a ~ dnExponential(1)
mymodel = model(a)
# Create a move vector and a monitor vector
moves[1] = mvScale(a, lambda = 1.0, weight = 1.0)
monitors[1] = mnFile(a, filename = "output/out.log")
# Run 64 power posterior analyses, each with 100 samples
pow_p = powerPosterior(mymodel, monitors, moves, "output/out.pp", cats=64, sampleFreq=1)
pow_p.run(generations=200, burninFraction=0.5)
# Create a path sampler object from a file that RevBayes
# automatically generated by concatenating the likelihoods from
# individual power posteriors
ps = pathSampler(file="output/out.pp", powerColumnName="power",
likelihoodColumnName="likelihood")
# Compute the marginal likelihood
ps.marginal()
# Compute the standard error
ps.stdError() # default formula
ps.stdError(bootstrap=TRUE) # bootstrap (100 replicates)
ps.stdError(bootstrap=TRUE, replicates=50, printFiles=TRUE) # bootstrap (50 replicates, save output)