PosteriorStatistics {ptycho} | R Documentation |
Extract Posterior Statistics
Description
Extract posterior statistics from a ptycho
object.
Usage
meanTau(obj)
varTau(obj)
meanIndicators(obj)
meanVarIndicators(obj)
meanGrpIndicators(obj)
Arguments
obj |
A |
Details
A ptycho
object contains means for many different variables. If
multiple chains were run, it has separate means for each, and it may have
running means from different points within each chain. The functions
described here simplify extracting from the input object certain statistics of
the posterior distribution sampled by ptycho
.
The function meanTau
identifies the last iteration saved in the input
ptycho
object and computes the mean of \tau
at that
iteration across all chains. The function varTau
is analogous,
computing var(\tau)
.
Similarly, meanIndicators
returns the mean across all chains of each
indicator variable. The functions meanVarIndicators
and
meanGrpIndicators
compute the means only of the indicators of variants
or only of second-level indicator variables, respectively.
Value
Both meanTau
and varTau
return a scalar.
The other functions, which extract means of indicator variables, return
vectors with names copied from the column names of the input obj
.
Author(s)
Laurel Stell and Chiara Sabatti
Maintainer: Laurel Stell <lstell@stanford.edu>
See Also
ptycho
, WhichCols; also Data describes
ptychoIn
and ptychoOut
in example below
Examples
data(ptychoIn)
data(ptychoOut)
# Compare averages of sampled group indicator variables to truth.
cbind(ptychoIn$replicates[[1]]$indic.grp,
meanGrpIndicators(ptychoOut))
# Compare averages of sampled covariate indicator variables to truth.
cbind(ptychoIn$replicates[[1]]$indic.var,
meanVarIndicators(ptychoOut))
# Compare average of sampled values of tau to truth.
ptychoIn$replicates[[1]]$tau
meanTau(ptychoOut)
# Variance of sampled values of tau is reasonable because sampled model
# is usually NOT empty.
varTau(ptychoOut)