Logistic mixture regression
cytoflexmix( df_samples_subset, protein_names, condition, group = "donor", cell_n_min = Inf, cell_n_subsample = 0, ks = seq_len(10), num_cores = 1 )
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 |
cell_n_min | Remove samples that are below this cell counts threshold |
cell_n_subsample | Subsample samples to have this maximum cell count |
ks | A vector of cluster sizes |
num_cores | Number of computing cores |
A list of class cytoglm
containing
list of flexmix
objects
possibly subsampled df_samples_subset table
input protein names
input condition variable
input group names
input cell_n_min
input cell_n_subsample
input ks
input num_cores
set.seed(23) df <- generate_data() protein_names <- names(df)[3:12] df <- dplyr::mutate_at(df, protein_names, function(x) asinh(x/5)) mix_fit <- CytoGLMM::cytoflexmix(df, protein_names = protein_names, condition = "condition", group = "donor", ks = 2) #> 2 : * * * * * mix_fit #> $flexmixfits #> $flexmixfits[[1]] #> #> Call: #> stepFlexmix(as.formula(varying_formula), data = df_samples_subset, #> model = FLXMRglm(family = "binomial"), k = 2, nrep = 5) #> #> Cluster sizes: #> 1 2 #> 6000 10000 #> #> convergence after 11 iterations #> #> #> $df_samples_subset #> # A tibble: 16,000 × 13 #> donor condition m01 m02 m03 m04 m05 m06 m07 m08 m09 m10 #> <int> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 1 treatment 0.390 3.93 3.84 1.94 1.94 1.94 3.11 3.18 1.14 3.44 #> 2 1 treatment 0 3.65 3.07 2.46 4.21 2.56 2.75 1.53 2.05 3.09 #> 3 1 treatment 0.199 1.75 3.04 4.29 2.35 1.61 1.14 1.02 2.70 4.70 #> 4 1 treatment 1.02 2.09 2.62 2.14 2.82 0.569 2.49 2.05 1.14 3.30 #> 5 1 treatment 1.99 2.49 1.82 4.02 2.19 0.733 1.44 0.881 2.56 2.05 #> 6 1 treatment 0.199 1.94 2.73 4.10 1.75 0.881 2.35 2.46 2.35 3.50 #> 7 1 treatment 2.27 4.27 1.44 1.25 5.29 2.14 2.35 2.59 1.25 2.35 #> 8 1 treatment 0.199 3.50 1.88 3.16 3.53 0.390 1.53 2.42 1.53 2.42 #> 9 1 treatment 0.390 2.27 2.96 1.68 2.39 1.94 3.02 4.35 2.42 4.50 #> 10 1 treatment 0.390 2.75 1.68 0.733 2.67 2.42 2.75 3.73 0.199 3.18 #> # … with 15,990 more rows, and 1 more variable: xtreatment <dbl> #> #> $protein_names #> [1] "m01" "m02" "m03" "m04" "m05" "m06" "m07" "m08" "m09" "m10" #> #> $condition #> [1] "condition" #> #> $group #> [1] "donor" #> #> $cell_n_min #> [1] Inf #> #> $cell_n_subsample #> [1] 0 #> #> $ks #> [1] 2 #> #> $num_cores #> [1] 1 #> #> attr(,"class") #> [1] "cytoflexmix"