E.step: Expectation step

Description Usage Arguments Details Value

View source: R/E.step.R

Description

Replace censored values by their expectations of censored FIB counts under the current parameter values, conditional on the counts being below the minimum level of detection.

Usage

1
E.step(alpha, beta, gamma, data, min.detect, event)

Arguments

alpha

vector of intercepts where each entry is the intercept for one species/event combination

beta

slope vector with one entry per FIB species, which indicates the marginal increase in that species' log-mean for a unit increase in the contamination index

gamma

contamination vector with one entry per row of data, indicating the contamination index for the corresponding row

data

matrix of FIB counts with one row per sample and one column per FIB species

min.detect

minimum detectable level of the FIB assay - counts below this threshold are censored

event

vector with one entry per row of data where each entry indicates the event with which the data row is associated

Details

This function imputes the expectations of censored data values and replaces the censored observations by their expectations, conditional on the censored values being below the minimum level of detection. The expectation is with respect to a Poisson distribution. It is calculated via the estimated parameters (\hat{\mathbf{α}}, \hat{\mathbf{β}}, \hat{\mathbf{γ}}) through the relationship

η = α + β γ

Y ~ Poisson(\exp(η)).

Let c_j be the minimum level of detection for column j of the data, and suppose that observation Y_{ij} is censored, meaning that our only knowledge of Y_{ij} is that Y_{ij} < c_j. Then the conditional expectation E (Y_{ij} | Y_{ij} < c_j) is

E (Y_{ij} | Y_{ij} < c_j) ∑_{k=1}^c_j \{ k λ_{ij}^k \exp (-λ_{ij}) Γ(k+1)^{-1} \} / \{ ∑_{k=1}^n λ_{ij}^k \exp (-λ_{ij}) Γ(k+1)^{-1} \},

where λ_{ij} = α_{ij} + β_j γ_i, α_{ij} is the intercept for observation i, bacteria species j, β_j is the slope for bacteria species j (meaning that β_j is the marginal increase in expected long-concentration of species j when the contamination increases by one unit), and γ_i is the contamination index of observation i.

Value

A matrix of FIB counts, where the censored counts are replaced by their expectations under the current parameters.


wrbrooks/latent documentation built on May 4, 2019, 11:59 a.m.