PosteriorStatistics: Extract Posterior Statistics

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Extract posterior statistics from a ptycho object.

Usage

1
2
3
4
5

Arguments

obj

A ptycho object

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 τ at that iteration across all chains. The function varTau is analogous, computing var(τ).

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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)

ptycho documentation built on May 2, 2019, 9:45 a.m.