Closed CaiWang0503 closed 8 months ago
Hi @CaiWang0503,
you can approximate standard errors with bootstrapping:
library(sjSDM)
SS = diag(1.0, 5)
SS[1,2] = SS[2,1] = 0.9
sim = simulate_SDM(correlation = SS,species = 5L, sites = 500L)
m = sjSDM(sim$response, sim$env_weights, device = 0)
S = getCor(m)
res=
lapply(1:30, function(i) {
ind = sample.int(500, 500, replace = TRUE)
m = sjSDM(sim$response[ind,], sim$env_weights[ind,], device = 0)
S = getCor(m)
return(S)
})
res_arr = abind::abind(res, along = 0)
mean = apply(res_arr, 2:3, mean) # mean effects
se = apply(res_arr, 2:3, sd) # standarderrors
Afterwards, you can calculate z-values and p-values:
# p-values
pnorm(abs(mean/se), lower.tail = FALSE)*2
thank you, Max.
Although the species associations are residuals in this case, but if I want to infer species interactions between species based on the strength of the pairwise relationship, how can I tell the relationship is strong and significant?