TheoreticalEcology / s-jSDM

Scalable joint species distribution modeling
https://cran.r-project.org/web/packages/sjSDM/index.html
GNU General Public License v3.0
68 stars 14 forks source link

Importance, R^2 and p-values for single env predictors. #73

Closed JulFrey closed 3 years ago

JulFrey commented 3 years ago

Hi,

maybe I just havent found it, but is there a way to see the importance, R^2 and p-value of a single environmental predictor? e.g. model <- sjSDM(Y = Occ, env = linear(data = Env, formula = ~X1+X2+X3), spatial = linear(data = SP, formula = ~0+X1:X2), se = TRUE, family=binomial("probit"), sampling = 100L, device = 'gpu' )

Where can I see the contribution of X3 in the model? I I got your outputs correct all predictors from the env argument are summed into A in the anova() and under env in the importance() output?!

Best regards, Julian

MaximilianPi commented 3 years ago

Hi Julian,

there is no central function for everything:

p-values and effect estimates

summary(model)

reports the p-value and the effect estimates of the individual predictors

R2 / analysis of variance

anova(model)

calculates the analysis of variance for the (two) three groups (env, spatial, and biotic).

res = anova(model)
print(res$result)

reports the variances and the R2 values for the three groups, but not for the individual predictors. But we can calculate the variance/R2 for each site (still experimentally):

res = anova(model, individual=TRUE)
dim(res$result)

Variation partitioning

importance(model)

calculates the variation partitioning of the three groups (env, spatial, and biotic) for each species. We could do this also for each predictor, but it is not yet implemented (we will add this feature in the next sub-version)

So we cannot yet calculate the R2 for each single environmental predictor but we will work on this.

Max

florianhartig commented 3 years ago

Just to add to this - it would of course be possible to calculate ANOVA for each predictor (and we could implement that), but due to the way we compute the ANOVA (see help) this would be computationally costly.

I'm not quite sure if it's worth it - calculating ANOVA for interactions / collinear variables can be a bit tricky. Depending on what you want to use this for, there can be an advantage of ANOVA over standardised effect sizes, but I think for most users, standardised effect sizes (= scale variables and look at summary), which can be interpreted as relative effect sizes, will be more in line with what they want.

JulFrey commented 3 years ago

Thank you very much for the very helpful replies.