Learn R Programming

CNPBayes (version 1.2.2)

posterior_cases: Calculate posterior proportion of cases by component

Description

Calculate posterior proportion of cases by component

Usage

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

Run this code
     # generate random case control status
     case_control <- rbinom(length(y(MarginalModelExample)), 1, 0.5)
     case_control_posterior <- posterior_cases(MarginalModelExample,
                                               case_control)

Run the code above in your browser using DataLab