Z_post: Posterior probability of acting through U

Description Usage Arguments Details Value

View source: R/Z_post.R

Description

For a set of data, X, calculate the probability that each variant acts through the shared factor U

Usage

1
Z_post(X, fit, nsamps = 1000, name_post = "")

Arguments

X

object of class cause_data. This need not be the same data used to compute 'fit'.

fit

object of class cause_post.

nsamps

Number of samples to take from the posterior (see Details).

Details

Let x_i represent the the data in the ith row of 'X'. Let Z_i be the indicator that variant i affects U. We are interested in computing P(Z_i = 1 | posteriors) where posteriors refers to the posterior parameter distributions contained in 'fit'. We compute l(x_i | posteriors, Z=1) and l(x_i | posteriors, Z_i = 0) where l denotes the likelihood. We then compute P(Z_i = 1 | posteriors) = l(x_i | posteriors, Z_i = 1)/(l(x_i | posteriors, Z_i = 1) + l(x_i | posteriors, Z_i = 0))

Value

A vector of probabilities corresponding to the rows of X


jean997/cause documentation built on Dec. 25, 2021, 10 p.m.