By using a lm or loess model as discriminant, the function outputs a dataframe where each brain area ("my_grouping") is provided with a strategy score ("strategy"). The strategy score is a number between 0 and 1, where 1 indicates that all samples of that brain area were categorized in "count strategy", and 0 that all samples of that brain area were categorized as "intensity strategy"

categorize_strategy(region_df, group_to_categorize, lm_or_loess = "lm")

Arguments

region_df

region_based dataframe. Each row is a brain area ("my_grouping") per sample ("sample_id"), where corrected cell count ("cells_perthousand") and average maximum intensity of the protein of interest ("intensity") have been summarized. It can be output from summarize_per_region(), where the meta variable "group" has been added.

group_to_categorize

refers to the group to categorize. All groups are used to build the discriminant.

lm_or_loess

specify the type of model to build the discriminant. Can have values c("lm", "loess"). Defaults to lm.

Value

Examples

x <- data.frame( batch = rep(c(1,1,2,2), each = 5), group = rep(c("control", "exp", "exp", "control"), each = 5), sample_id = rep(c("a", "b", "c", "d"), each = 5), my_grouping = rep(c("CA1", "CA2", "CA3", "DG", "BLA"), 4), intensity = sample(10000, 20, replace = TRUE), cells_perthousand = abs(rnorm(20)) ) y <- categorize_strategy(x, "control")
#> Error in region_df %>% dplyr::filter(group %in% group_to_categorize) %>% dplyr::ungroup() %>% dplyr::mutate(y_predicted = predict(md, cells_perthousand)) %>% dplyr::mutate(strategy = ifelse(intensity >= y_predicted, "intensity_strategy", "count_strategy")): could not find function "%>%"