knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.height = 4,
  fig.width = 7
)
library("cytoeffect")

In this vignette, we show the cytoeffect workflow for both the full Bayesian hierarchical model and the parametric bootstrap with the simplified model.

Generate Data

Simulate dataset.

set.seed(1)
df = simulate_data()
str(df)
df
condition = "condition"
group = "donor"
protein_names = names(df)[3:ncol(df)]

Bayesian Inference

Sample from posterior distribution using Stan.

fit = poisson_lognormal(df, 
                        protein_names = protein_names, 
                        condition = condition, 
                        group = group,
                        r_donor = 2, 
                        warmup = 200, iter = 325, adapt_delta = 0.8,
                        num_chains = 1)

Plot marginal credible intervals.

plot(fit, type = "theta")
plot(fit, type = "beta")
plot_pairs(fit, "m01", "m02", "m03")
plot(fit, type = "sigma")
plot(fit, type = "Cor")

Multivariate DiSTATIS plot.

plot_distatis(fit, ndraws = 125)

Frequentist Inference

Fit model using composite maximum likelihood estimatation.

fit = poisson_lognormal_mcle(df, 
                             protein_names = protein_names, 
                             condition = condition, 
                             group = group,
                             ncores = 1)

Plot marginal credible intervals.

plot(fit, type = "beta")
plot(fit, type = "sigma")
plot(fit, type = "Cor")

Multivariate DiSTATIS plot.

plot_distatis(fit, ndraws = 125)


ChristofSeiler/cytoeffect documentation built on Jan. 11, 2023, 1:05 p.m.