reptalex / phylofactor

26 stars 9 forks source link

Phylofactorization with random variables #37

Closed ATCHON closed 3 years ago

ATCHON commented 3 years ago

Hello, I have an OTU count table. I want performed phylofactorization on a two-level independent variable Control and Sick(AIA) that I extracted from my metadata. However, I have an another structures of my data by age of the subject (4, 11 and 28) as random variable that I want to take into account. How can I construct the analysis to do that ?

Variables

reptalex commented 3 years ago

Hi there!

See ? PhyloFactor where I construct a customized objective function - you can create your own objective function with any model you want, so long as that never returns and error or errors are handled with tryCatch().

Customized objective functions take an ILR projection of the data corresponding to a given edge, y, your meta data, X, and a logical PF.output.

when PF.output=FALSE, the function must return a number or it may return a list containing output$objective (a number - the largest objective is chosen for phylofactorization) and output$stopStatistic (e.g. a P-value for the stop.fcn to assess whether it’s time to kill the algorithm).

when PF.output=TRUE, the function can return anything you’d like to see, such the linear model with random effects for the winning edge’s ILR projection.

hope this helps!

ATCHON commented 3 years ago

Hello,

Thank you for your help. I found an example application for the construction of customized objective functions in the R documentation (https://rdrr.io/github/reptalex/phylofactor/man/PhyloFactor.html).

Sincerely yours.

reptalex commented 3 years ago

Glad we could get you set up - enjoy the analyses!