Skip to content
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

Enable group-level weight specification in flm_def constrast construction #39

Open
lianos opened this issue Jul 28, 2020 · 0 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@lianos
Copy link
Member

lianos commented Jul 28, 2020

You can combine multiple groups in the numer or denom when constructing a linear model.

Currently it gives each group within the numer/denom equal weight, but you may want to adjust that.

Using the example tcga dataset, we can compare stage1 and stage2 vs stage3 and stage4 tumors like so:

library(FacileAnalysis)
library(FacileData)

efds <- exampleFacileDataSet()
es <- filter_samples(efds, indication == "BLCA", sample_type == "tumor")

flm.equal <- flm_def(es, "stage", numer = c("I", "II"), denom = c("III", "IV"))

That would construct a contrast vector that compares the average of stage I and II vs the average of stage III and IV, like so:

   I   II  III   IV 
 0.5  0.5 -0.5 -0.5 

But what if you wanted something like this?

    I    II  III   IV 
 0.75  0.25 -0.5 -0.5 

Potential Syntax

Option 1

The names of the numer/denom character vectors could be the group names, and the values could be the fractional weights:

flm.weighted <- flm_def(es, numer = c("I" = 0.75, "II" = 0.25), denom = c("III", "IV"))

This would require us to check the numer/denom vectors to see if they were numeric or character first, and then pull the names of the groups and their weights from the appropriate.

Option 2

Or vice versa? This way may require less (code) hacking, but I'm not the biggest fan of havig numbers for names() of a vector

flm.weighted <- flm_def(es, numer = c("0.75" = "I", "0.25" = "II"), denom = c("III", "IV"))

Option 3

You could imagine having a separate parameter for group weights, but ...

@lianos lianos added the enhancement New feature or request label Jul 28, 2020
@lianos lianos self-assigned this Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant