poisson_lognormal: HMC sampling for Poisson log-normal mixed model

View source: R/poisson_lognormal.R

poisson_lognormalR Documentation

HMC sampling for Poisson log-normal mixed model

Description

poisson_lognormal uses Hamiltonion Monte Carlo to sample form an extend Poisson log-normal mixed model. Each cell and protein marker has its own rate parameter following a linear model.

Usage

poisson_lognormal(
  df_samples_subset,
  protein_names,
  condition,
  group,
  r_donor,
  eta = 1,
  iter = 325,
  warmup = 200,
  num_chains = 1,
  adapt_delta = 0.8,
  seed = 1
)

Arguments

df_samples_subset

Data frame or tibble with proteins counts, cell condition, and group information

protein_names

A vector of column names of protein to use in the analysis

condition

The column name of the condition variable

group

The column name of the group variable

r_donor

Rank of the donor random effect covariance matrix

eta

Hyperparameter for LKJ prior

iter

Number of iteration per chain for the HMC sampler

warmup

Number of warm up steps per chain for the HMC sampler

num_chains

Number of HMC chains to run in parallel

adapt_delta

Parameter to control step size of numerical solver

seed

Set seed for HMC sampler (higher value means smaller step size, max is 1)

Value

A list of class cytoeffect_poisson containing

fit_mcmc

rstan object

protein_names

input protein names

condition

input condition variable

group

input group names

df_samples_subset

input df_samples_subset table

Examples

set.seed(1)
df = simulate_data(n_cells = 10)
str(df)
fit = poisson_lognormal(df,
                        protein_names = names(df)[3:ncol(df)],
                        condition = "condition",
                        group = "donor",
                        r_donor = 2,
                        warmup = 200, iter = 325, adapt_delta = 0.95,
                        num_chains = 1)


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