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

Interaction term in nebula #16

Closed
AdelynTsai opened this issue Jan 30, 2023 · 8 comments
Closed

Interaction term in nebula #16

AdelynTsai opened this issue Jan 30, 2023 · 8 comments

Comments

@AdelynTsai
Copy link

Hi,
Thank you for the tool. It's very helpful!
I'm wondering if it's possible to include an interaction term in the nebula, and if so, how should I code it?

Here's how I code now without the interaction:
cov.mm <- model.matrix(~sqrtCAA + Batch_Flowcell + Gender + Age_At_Death, data=meta.data.f)
nebulafit <- nebula(count=nebula.mm.f,id=meta.data.f$subject,pred=cov.mm,offset=total)

sqrtCAA is the phenotype of interest (it's a continuous phenotype), Batch_Flowcell + Gender + Age_At_Death are the fixed covariates, and subject is the random covariate.

However, I also have some biochemical measures and I want to know how the effect of biochemical measures together with sqrtCAA can affect expression. I'd like to do this analysis with Nebula. Please let me know if this is possible.

Thank you!

@lhe17
Copy link
Owner

lhe17 commented Jan 31, 2023 via email

@AdelynTsai
Copy link
Author

Hi Liang,
Thank you for your response!
One other question I have is that given that my phenotype (sqrtCAA) is a continuous variable, can I interpret the logFC_sqrtCAA in the summary output as the correlation coefficient (i.e. beta/estimate)?

Thank you again!

@lhe17
Copy link
Owner

lhe17 commented Feb 3, 2023 via email

@AdelynTsai
Copy link
Author

AdelynTsai commented Mar 2, 2023

Hi Liang,
Thanks for your previous answers. I've started doing interaction analysis using Nebula. As previously mentioned, I used cov.mm <- model.matrix(~sqrtCAA*biochem + Batch_Flowcell + Gender + Age_At_Death, data=meta.data.f).
I have some questions about interpreting the results from the interaction analysis. I attached the results from 2 genes here from DEG analysis with sqrtCAA alone, with biochemical measures alone (cd31_tx_std & ab40_tbs_ln_std) and with interactions between sqrtCAA x biochemical measures.
I know I should be specifically looking at the interaction results from the column with sqrtCAA:biochem, but I'm wondering why the logFC_sqrtCAA and logFC_biochem from the interaction analysis, as well as the results of se and p, so different from the logFC, se and p when I did the analysis with just the sqrtCAA and biochemical measures alone?

Thank you so much again!

@lhe17
Copy link
Owner

lhe17 commented Mar 3, 2023 via email

@AdelynTsai
Copy link
Author

AdelynTsai commented Mar 3, 2023

Hi Liang,
sqrtCAA and biochem are sample-level variables. Both of them are continuous variables.

Samples and cells differ by the biochem measures and cell type. For the example I gave, Astrocyte cd31_tx has 78 samples and 17722 cells. For microglia ab40_tbs, there are 78 samples and 18409 cells. In general, I've a range from 74~78 samples and 971 cells to 44151 cells among all the cell types I have.

For the design matrix, when I used model.matrix(~sqrtCAA*biochem + Batch_Flowcell + Gender + Age_At_Death, data=meta.data.f), there are 9 columns corresponding to the variables I gave in the model.matrix (I've 5 different batch_flowcell that makes it 4 different batch_flowcell columns in the design matrix). On the other hand, when I put both variables in the model without the interaction term, which is model.matrix(~sqrtCAA + biochem + Batch_Flowcell + Gender + Age_At_Death, data=meta.data.f), I've 8 columns. It seems like when I used the interction term in the model.matrix, I got a column sqrtCAA:biochem which is the product of sqrtCAA x biochem. I included the two design matrices from astrocyte_cd31tx in the 2nd and 3rd tab of the excel file attached here.

As for the results when I put both variables in the model without the interaction term, I put them in the first tab in the excel file. There're no additional sqrtCAA:biochem columns if I don't include the interaction term.

Thank you for your help.

@lhe17
Copy link
Owner

lhe17 commented Mar 4, 2023 via email

@lhe17
Copy link
Owner

lhe17 commented Mar 9, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants