-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug fix for fredman posthoc #485
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were a few parts I wasnt sure about, see my questions. Happy to schedule a meeting if that would be easier.
@@ -311,6 +313,7 @@ olink_one_non_parametric_posthoc <- function(df, | |||
olinkid_list = NULL, | |||
variable, | |||
test = "kruskal", | |||
subject = "Subject", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this default to Null and expect that there is no subject data
@@ -259,6 +260,7 @@ olink_one_non_parametric <- function(df, | |||
#' @param olinkid_list Character vector of OlinkID's on which to perform post hoc analysis. If not specified, all assays in df are used. | |||
#' @param variable Single character value or character array. | |||
#' @param test Single character value indicates running the post hoc test for friedman or kruskal. | |||
#' @param subject Single character value indicates running the post hoc test for friedman or kruskal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the name of a column or just a string. If there are options we should specify them in the documentation
@@ -259,6 +260,7 @@ olink_one_non_parametric <- function(df, | |||
#' @param olinkid_list Character vector of OlinkID's on which to perform post hoc analysis. If not specified, all assays in df are used. | |||
#' @param variable Single character value or character array. | |||
#' @param test Single character value indicates running the post hoc test for friedman or kruskal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add strings for tests
dplyr::select(!!!rlang::syms(subject)) %>% | ||
dplyr::pull() %>% | ||
unique())){ | ||
message(paste("Subjects removed due to incomplete data")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add list of subject IDs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are subjects only removed from specific assays?
dplyr::mutate(Friedman_remove = "no") %>% | ||
dplyr::select(-n) | ||
|
||
if(length(subject_remove %>% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the Friedman test not work with subjects that are missing timepoints?
' has only NA:s in atleast one level of ', | ||
effect, | ||
'. It will not be tested.'), | ||
call. = F) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call. = F) | |
call. = FALSE) |
} | ||
} | ||
|
||
formula_string <- paste0(data_type, "~", paste(variable,collapse="*")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the formula include subject as well? Like in the LME? (Unsure how this model using the formula string)
unique() %>% | ||
pull() %>% | ||
length() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
n_subject -> number of levels in a variable?
dplyr::filter(n == n_subject) %>% | ||
dplyr::mutate(Friedman_remove = "no") %>% | ||
dplyr::select(-n) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
subject_remove -> subject-Assay combos that are not missing levels of the variable
@@ -41,6 +41,7 @@ kruskal_posthoc_results <- olink_one_non_parametric_posthoc(npx_data1, | |||
friedman_posthoc_results <- olink_one_non_parametric_posthoc(npx_data1, | |||
variable = "Time", | |||
test = "friedman", | |||
subject = "Subject", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a unit test to test for this case?
Can we also address Issue #346 in this PR |
Title: Debug of the Friedman posthoc tests
Problem: When the data is not sorted by tested variable and subject, there is a chance that the paired Wilcoxon test will not be performed properly
Solution: sort the data based on tested variable and subject.
Key Features:
Checklist
Type of changes
What type of changes does your code introduce?
Put an
x
in the boxes that applyFurther comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, any questions you have, etc...
Consider linking any issues (#issue-number ) or adding @mentions to ensure specific people see it.