Skip to content

Get all pairwise comparisons from model #161

@liezeltamon

Description

@liezeltamon

Hi @fabsig,

Thank you for the great package! I'm really new to this and I am trying to use it with my single-cell data as I have a mixture of independent and longitudinal groups as shown here:

data <- data.frame(
  celltype_a = c(
    1,1,1,1,
    1,1,0,1,
    0,1,0,0
  ),
  group_id = c(
    "A", "A", "A", "A",
    "Pre", "Pre", "Pre", "Pre",
    "Post", "Post", "Post", "Post"
  ),
  individual_id = c(
    "A1", "A2", "A3", "A4",
    "P1", "P2", "P3", "P4",
    "P1", "P2", "P3", "P4"
  ),
  pool_id = c(
    rep(c("batch1", "batch2", "batch3", "batch4"))
  )
)

> data
   celltype_a group_id individual_id pool_id
1           1        A            A1  batch1
2           1        A            A2  batch2
3           1        A            A3  batch3
4           1        A            A4  batch4
5           1      Pre            P1  batch1
6           1      Pre            P2  batch2
7           0      Pre            P3  batch3
8           1      Pre            P4  batch4
9           0     Post            P1  batch1
10          1     Post            P2  batch2
11          0     Post            P3  batch3
12          0     Post            P4  batch4

So I want to see whether there are significant differences across group_id levels in terms of proportion of one cell type and then overall change along A -> Pre - > Post trajectory. In group_id, Pre and Post are repeated measures, while A is independent.

This is the output that I got and I wanted to confirm that is it not possible to get the comparison between Pre and Post? With lme4, I am getting the information for pairwise comparisons with the emmeans package.

fixed_effects_matrix <- model.matrix(celltype_a ~ group_id + pool_id, data = data)
mod_gpb <- fitGPModel(likelihood = "bernoulli_logit",
                      X = fixed_effects_matrix, 
                      group_data = data[["individual_id"]], 
                      y = data[["celltype_a"]], params = list(std_dev = TRUE))
summary(mod_gpb)

> summary(mod_gpb)
=====================================================
Model summary:
Log-lik     AIC     BIC 
   0.00   14.00   17.39 
Nb. observations: 12
Nb. groups: 8 (Group_1)
-----------------------------------------------------
Covariance parameters (random effects):
        Param.
Group_1  3e-04
-----------------------------------------------------
Linear regression coefficients (fixed effects):
                Param. Std. dev. z value P(>|z|)
(Intercept)    47.2072  4413.918  0.0107  0.9915
group_idPost  -63.4535  4801.050 -0.0132  0.9895
group_idPre   -31.5929  3809.104 -0.0083  0.9934
pool_idbatch2  32.9021  4970.412  0.0066  0.9947
pool_idbatch3 -31.3698  3454.073 -0.0091  0.9928
pool_idbatch4   0.1634  2844.962  0.0001  1.0000
=====================================================

Thank you so much!

Best,
Liezel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions