posterior_cases: Calculate posterior proportion of cases by component

Description Usage Arguments Value Examples

View source: R/functions.R

Description

Calculate posterior proportion of cases by component

Usage

1
posterior_cases(model, case_control, alpha = 1, beta = 1)

Arguments

model

An instance of a MixtureModel-derived class.

case_control

A vector of 1's and 0's where a 1 indicates a case and a 0 a control

alpha

prior alpha for the beta

beta

prior beta for the beta

Value

A matrix of dimension S (MCMC iterations) by K (number of components) where each element i,j indicates the posterior proportion of cases at an iteration and component

Examples

1
2
3
4
5
6
7
## Not run: 
     # generate random case control status
     case_control <- rbinom(length(y(SingleBatchModelExample)), 1, 0.5)
     case_control_posterior <- posterior_cases(SingleBatchModelExample,
                                               case_control)

## End(Not run)

CNPBayes documentation built on Nov. 1, 2018, 4:47 a.m.