\HeaderA{pmpW.bma}{Posterior Model Probabilities of Weight Matrices}{pmpW.bma}
\keyword{utilities}{pmpW.bma}
\begin{Description}\relax
Returns the posterior models probabilites based on the best models encountered by a 'bma' object
\end{Description}
\begin{Usage}
\begin{verbatim}
pmpW.bma(object)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] A spatial filtering bma object see argument \code{nmodel} in \code{\LinkA{spatFilt.bms}{spatFilt.bms}}) 
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
A call to bms with an MCMC sampler (e.g. \code{spatFilt.bms(datafls,mcmc="bd",nmodel=100)} uses a Metropolis-Hastings algorithm to sample through the model space - and the frequency of how often models are drawn converges to the distribution of their posterior marginal likelihoods.
While sampling, each 'bma' object stores the best models encountered by its sampling chain with their marginal likelihood and their MCMC frequencies.

\code{pmp.bma} then allows for comparing the posterior model probabilities (PMPs) for the two different methods, similar to \code{\LinkA{plotConv}{plotConv}}.
It calculates the PMPs based on marginal likelihoods (first column) and the PMPs based on MCMC frequencies (second column) for the best x models stored in the bma object.

The correlation of the two columns is an indicator of how well the MCMC sampler has converged to the actual PMP distribution - it is therefore also given in the output of \code{\LinkA{summary.bma}{summary.bma}}.

The second column thus shows the PMPs of the best models relative to all models the call to \code{\LinkA{bms}{bms}} has sampled through (therefore typically the second column adds up to less than one).
However, the first column only relates to the likelihoods of the best models, therefore it adds up to 1. (the marginal likelihoods for the models not retained in the best models cannot be known).
\end{Details}
\begin{Value}
the result is a matrix with rownames corresponding to the names of the weight matrices\\
There are two columns in the matrix:
\begin{ldescription}
\item[\code{PMP (Exact)}] posterior model probabilities based on the posterior likelihoods of the best models in \code{object}, relative to all 'best' models
\item[\code{PMP (MCMC)}] posterior model probabilities of the best models in \code{object} based on their MCMC frequencies, relative to all models encountered by \code{object} - see 'Details' 
\end{ldescription}
\end{Value}
\begin{Author}\relax
Martin Feldkircher
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{spatFilt.bms}{spatFilt.bms}} for sampling bma objects 

Check \url{http://bms.zeugner.eu} for additional help.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
   # sample BMA for boston housing data MCMC sampler
   data(dataBoston); data(WL.boston)
   bma1=spatFilt.bms(X.data=dataBoston,WList=WL.boston,burn=1e04,iter=1e04,nmodel=100)
   pmpW.bma(bma1)

\end{ExampleCode}
\end{Examples}

