lamho86 / phylolm

GNU General Public License v2.0
30 stars 12 forks source link

phylolm results do not match binary.PGLMM results. How to explain that? #26

Closed Jigyasa3 closed 4 years ago

Jigyasa3 commented 4 years ago

Hey all

I wanted to ask if - a) its possible for two statistical tests not to give similar results? b) if yes, then how can I explain the differences?

my data- sample diet_type bacterial_category sample1 1 0 sample2 2 1 sample3 1 1 sample3 2 0 sample4 3 0

the r code-

library(phylolm) summary(phyloglm(bactero ~ as.factor(diet_type_number2), phy=pruned.trees, data=bacterial_groups))

output-

Call: phyloglm(formula = bactero ~ as.factor(diet_type_number2), data = bacterial_groups, phy = pruned.trees) AIC logLik Pen.logLik 179.13 -85.57 -82.81

Method: logistic_MPLE Mean tip height: 116.187 Parameter estimate(s): alpha: 0.04745155

Coefficients: Estimate StdErr z.value p.value
(Intercept) -0.35924 0.33408 -1.0753 0.282234
as.factor(diet_type_number2)2 1.50004 0.58005 2.5861 0.009707 * as.factor(diet_type_number2)3 1.11070 0.53438 2.0785 0.037666

Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1

Note: Wald-type p-values for coefficients, conditional on alpha=0.04745155

second_method-

library(ape) binaryPGLMM(bactero ~ as.factor(diet_type_number2), phy=pruned.trees, data=bacterial_groups)

output-

Call:bactero ~ as.factor(diet_type_number2)

Random effect (phylogenetic signal s2): s2 Pr 1 1.346 0.01215

Fixed effects: Value Std.Error Zscore Pvalue (Intercept) -0.29269 0.62758 -0.4664 0.6409 as.factor(diet_type_number2)2 1.10401 0.80099 1.3783 0.1681 as.factor(diet_type_number2)3 0.71368 0.76539 0.9324 0.3511

lamho86 commented 4 years ago

Hello:

It looks like binaryPGLMM fits a different model than phyloglm. So, the results can be different.

Lam

cecileane commented 4 years ago

It looks like it's a different model, and a different method too. The difference between generalized mixed models (GLMM) versus generalized estimating equations (GEE) might be at play here. See this recent r-sig-phylo question for a large difference in statistical significance, also.

Jigyasa3 commented 4 years ago

Thanks @lamho86 and @cecileane for the advice! I will check the methods themselves.