Description Usage Arguments Value References Examples
This function estimates the parameters of a model using the M-posterior method developped by Minsker et al. (2014). It models the subposterior of subset X_k as
π_k(θ | X_k) ∝ π(θ) (∏ p(x|θ))^K
Parameter estimates are subsequently weighted according to their geometric mean.
1 2 3 4 5 6 7 8 9 10 11 12 |
chains |
Number of subsets in the simulation. Used when a divide-and-conquer algorithm is employed. |
para |
Parameters to be estimated. |
startval |
Initial value of the chain. |
niter |
Number of iterations (including burned iterations). |
X |
Matrix of observations from the underlying data set. |
prior |
Prior function for the parameters. |
likelihood |
Likelihood function. |
propvar |
The diagonal of the variance matrix for the proposal distribution. If no value is specified, the identify matrix is used. |
burn.rate |
The percentage of iterations to be burned. |
random |
If true, the rows of X are shuffled prior to the split. |
A list with the following items:
Chains
A list of dataframes, one for each subset, containing the generated Markov chains.
Estimate
The parameter estimate obtained using the M-posterior method.
Stanislav Minsker, Sanvesh Srivastava, Lizhen Lin, and David B. Dunson. Scalable and robust bayesian inference via the median posterior. In Proceedings of the 31st International Conference on International Conference on Machine Learning - Volume 32, ICML’14, page II–1656–II–1664. JMLR.org, 2014.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #Parameter estimation for data from a Weibull distribution
#Prior
prior<-function(param){
ifelse(all(param>0), 1, 0)
}
#Likelihood
weibull.likelihood<-function(X, param){
shape=param[1]
scale=param[2]
sum(dweibull(x=X, shape, scale, log=TRUE))
}
#Simulate data
X<-rweibull(100, 2, 1.2)
#Parameters
chains<-10
para<-c("shape", "scale")
niter<-10000
startval<-c(1.5, 1)
likelihood=weibull.likelihood
df<-mpost(chains, para, startval, niter, X, prior, likelihood,
propvar=NULL, burn.rate=0.1, random=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.