mastoffel / partR2

R package to partition R2 among predictors in Generalized linear mixed models
21 stars 3 forks source link

commonalities from the PartR2 output #8

Open narunpat opened 2 years ago

narunpat commented 2 years ago

Thank you so much for creating a neat package!

I have been looking for a package to do commonality analyses in a mixed model.

In your PeerJ article, you said “The package does not report partial R2 and commonalities, although they could be calculated from the partR2 output.”. I am now trying to use the formulae you gave in Figure 1 of the article.

I would greatly appreciate it if you can double-check my calculation below.

From the biomass example, here are the Part R2 results from the package.

> R2 (marginal) and 95% CI for the full model:

> R2 CI_lower CI_upper nboot ndf

> 0.5133 0.4136 0.5889 100 4

>

> ----------

>

> Part (semi-partial) R2:

> Predictor(s) R2 CI_lower CI_upper nboot ndf

> Model 0.5133 0.4136 0.5889 100 4

> SpeciesDiversity 0.1729 0.0322 0.2792 100 3

> Temperature 0.3058 0.1842 0.3966 100 3

> Year 0.0140 0.0000 0.1362 100 3

> SpeciesDiversity+Temperature 0.4916 0.3918 0.5663 100 2

> SpeciesDiversity+Year 0.1862 0.0475 0.2913 100 2

> Temperature+Year 0.3276 0.2091 0.4155 100 2

> SpeciesDiversity+Temperature+Year 0.5133 0.4136 0.5889 100 1

To compute commonalities, here what I did:

Commonalities (SpeciesDiversity & Temperature): Part (SpeciesDiversity+Temperature) – Part (SpeciesDiversity) – Part (Temperature) = 0.4916 - 0.1729 - 0.3058 = 0.0129

Commonalities (SpeciesDiversity & Year): Part (SpeciesDiversity+Year) – Part (SpeciesDiversity) – Part (Year) = 0.1862 - 0.1729 - 0.0140 = -0.0007

Commonalities (Temperature & Year): Part (Temperature+Year) - Part(Temperature) – Part(Year) = 0.3276 - 0.3058 - 0.0140 = 0.0078

Commonalities (SpeciesDiversity & Temperature & Year): Part (SpeciesDiversity+Temperature+Year) – Part (SpeciesDiversity+Temperature) - Part (SpeciesDiversity+Year) - Part (Temperature+Year) + Part (SpeciesDiversity) + Part (Temperature) + Part (Year) = 0.5133 - 0.4916 - 0.1862 - 0.3276 + 0.1729 + 0.3058 + 0.0140 = 0.0006

Does it sound reasonable?

If so, I have two questions: 1) How do we obtain confidence intervals for the commonalities? 2) What does it mean when we have a negative commonality.

Thank you again,

Narun