as.quantiles | R Documentation |
Extract quantile distribution from mcmcComposite object
as.quantiles(
x,
chain = 1,
fun = function(...) return(as.numeric(list(...))),
probs = c(0.025, 0.975),
xlim = NULL,
nameparxlim = NULL,
namepar = NULL
)
x |
A mcmcComposite obtained as a result of |
chain |
The number of the chain in which to get parameters |
fun |
The function to apply the parameters |
probs |
The probability to get quantiles |
xlim |
The values to apply in fun |
nameparxlim |
The name of the parameter for xlim |
namepar |
The name of parameters from mcmc object to be used in fun |
A data.frame with quantiles
Marc Girondot marc.girondot@gmail.com
Other mcmcComposite functions:
MHalgoGen()
,
as.mcmc.mcmcComposite()
,
as.parameters()
,
merge.mcmcComposite()
,
plot.PriorsmcmcComposite()
,
plot.mcmcComposite()
,
setPriors()
,
summary.mcmcComposite()
## Not run:
library(HelpersMG)
require(coda)
x <- rnorm(30, 10, 2)
dnormx <- function(data, x) {
data <- unlist(data)
return(-sum(dnorm(data, mean=x['mean'], sd=x['sd'], log=TRUE)))
}
parameters_mcmc <- data.frame(Density=c('dnorm', 'dlnorm'),
Prior1=c(10, 0.5), Prior2=c(2, 0.5), SDProp=c(1, 1),
Min=c(-3, 0), Max=c(100, 10), Init=c(10, 2), stringsAsFactors = FALSE,
row.names=c('mean', 'sd'))
mcmc_run <- MHalgoGen(n.iter=10000, parameters=parameters_mcmc, data=x,
likelihood=dnormx, n.chains=1, n.adapt=100, thin=1, trace=1)
k <- as.quantiles(x=mcmc_run, namepar="mean")
k <- as.quantiles(x=mcmc_run, namepar="mean",
xlim=c(1:5), nameparxlim="sd",
fun=function(...) return(sum(as.numeric(list(...)))))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.