Commit 34b85f25 authored by Boulangeat Isabelle's avatar Boulangeat Isabelle

rebuild main analysis output document

parent a040a2b7
...@@ -3,9 +3,9 @@ title: "Main_analyse.Rmd" ...@@ -3,9 +3,9 @@ title: "Main_analyse.Rmd"
author: "Isabelle Boulangeat" author: "Isabelle Boulangeat"
date: "23/01/2020" date: "23/01/2020"
output: output:
md_document:
variant: markdown_github
html_document: html_document:
keep_md: yes
variant: markdown_github
editor_options: editor_options:
chunk_output_type: console chunk_output_type: console
always_allow_html: true always_allow_html: true
...@@ -97,7 +97,7 @@ res.tab.eval = as.data.frame(do.call(rbind, lapply(eval.models, function(x)unlis ...@@ -97,7 +97,7 @@ res.tab.eval = as.data.frame(do.call(rbind, lapply(eval.models, function(x)unlis
res.tab.vars = as.data.frame(do.call(rbind, lapply(eval.models, function(x)unlist(x[5:6])))) res.tab.vars = as.data.frame(do.call(rbind, lapply(eval.models, function(x)unlist(x[5:6]))))
kable(res.tab.eval, caption = "model evaluation", digits = 2) %>% kable_styling(bootstrap_options = c("striped", "hover", "responsive"), full_width=FALSE) kable(res.tab.eval, caption = "model evaluation", digits = 2) %>% kable_styling(bootstrap_options = c("striped", "hover", "responsive"), full_width=FALSE)
kable(res.tab.vars, caption = "selected variables")%>% kable_styling(bootstrap_options = c("striped", "hover", "responsive"), font_size = 10) # kable(res.tab.vars, caption = "selected variables")%>% kable_styling(bootstrap_options = c("striped", "hover", "responsive"), font_size = 10)
``` ```
N.B. Some models do not fit well. The variables explain more or less depending on species but also on processes (extinction and colonisation). N.B. Some models do not fit well. The variables explain more or less depending on species but also on processes (extinction and colonisation).
...@@ -133,7 +133,7 @@ data.frame(unclass(table(coeffs.all$var, coeffs.all$process))) %>% ...@@ -133,7 +133,7 @@ data.frame(unclass(table(coeffs.all$var, coeffs.all$process))) %>%
kable_styling("striped") kable_styling("striped")
``` ```
## Variables effect coefficients ## Variable effect coefficients
This gives a summary of selected variables with significant impact on colonisation or extinction and their estimated coefficients. This gives a summary of selected variables with significant impact on colonisation or extinction and their estimated coefficients.
...@@ -153,18 +153,15 @@ coeffs.all[which(coeffs.all$process == "extinction" & coeffs.all$Pr...z..<0.1),] ...@@ -153,18 +153,15 @@ coeffs.all[which(coeffs.all$process == "extinction" & coeffs.all$Pr...z..<0.1),]
## Lambda (1-ext/colo) ## Lambda (1-ext/colo)
An overview of the performance of populations by site of by species An overview of the performance of populations by site of by species
```{r lambda, fig-TRUE, fig.width=10} ```{r lambda, fig-TRUE, fig.width=10, warning=FALSE, fig.height=7}
all.sites = unique(DATA$cover[,c("SemiUniquePLOT", "YEAR", "SUBSITE", "SoilMoist", "TotalCover")]) all.sites = unique(DATA$cover[,c("SemiUniquePLOT", "YEAR", "SUBSITE", "SoilMoist", "TotalCover")])
pDATA = proj.dat.shape(all.sites, DATA$climato) pDATA = proj.dat.shape(all.sites, DATA$climato)
str(pDATA)
summary(pDATA)
selectVars = c("snowDays", "GSL", "GST", "SoilMoist", "TotalCover") selectVars = c("snowDays", "GSL", "GST", "SoilMoist", "TotalCover")
pDATA.all = na.omit(pDATA[,c(selectVars,"SemiUniquePLOT", "YEAR", "SUBSITE") ]) pDATA.all = na.omit(pDATA[,c(selectVars,"SemiUniquePLOT", "YEAR", "SUBSITE") ])
pred.all = lapply(spDATA.fit, predictions, pred.data = pDATA.all, selectVars=selectVars) pred.all = lapply(spDATA.fit, predictions, pred.data = pDATA.all, selectVars=selectVars)
pred.tab = lapply(pred.all, function(x)data.frame(sp = x$sp, lambda = x$lambda, YEAR = x$YEAR, SUBSITE = x$SUBSITE)) pred.tab = lapply(pred.all, function(x)data.frame(sp = x$sp, lambda = x$lambda, YEAR = x$YEAR, SUBSITE = x$SUBSITE))
pred.all.together = do.call(rbind, pred.tab) pred.all.together = do.call(rbind, pred.tab)
head(pred.all.together)
pred.all.together[-which(pred.all.together$sp == "Rubus chamaemorus"), ] %>% pred.all.together[-which(pred.all.together$sp == "Rubus chamaemorus"), ] %>%
ggplot(aes(YEAR, lambda)) + ggplot(aes(YEAR, lambda)) +
...@@ -180,7 +177,7 @@ pred.all.together[-which(pred.all.together$sp == "Rubus chamaemorus"), ] %>% ...@@ -180,7 +177,7 @@ pred.all.together[-which(pred.all.together$sp == "Rubus chamaemorus"), ] %>%
ggplot(aes(SITE, lambda, sp)) + ggplot(aes(SITE, lambda, sp)) +
theme(axis.text.x = element_text(angle=90, hjust=1)) + theme(axis.text.x = element_text(angle=90, hjust=1)) +
geom_boxplot() + geom_hline(yintercept = 0) + geom_boxplot() + geom_hline(yintercept = 0) +
facet_wrap( ~ sp,scales = "free_x", ncol = 4) facet_wrap( ~ sp,scales = "free_x", ncol = 7)
pred.all.together[-which(pred.all.together$sp == "Rubus chamaemorus"), ] %>% pred.all.together[-which(pred.all.together$sp == "Rubus chamaemorus"), ] %>%
ggplot(aes(SITE, lambda, sp)) + ggplot(aes(SITE, lambda, sp)) +
...@@ -190,7 +187,7 @@ pred.all.together[-which(pred.all.together$sp == "Rubus chamaemorus"), ] %>% ...@@ -190,7 +187,7 @@ pred.all.together[-which(pred.all.together$sp == "Rubus chamaemorus"), ] %>%
``` ```
Simplified version focusing only on the sign of lambda Simplified version focusing only on the sign of lambda
```{r lambda_sign, fig=TRUE, fig.width=10} ```{r lambda_sign, fig=TRUE, fig.width=10, warning=FALSE}
pred.all.together$lambdaSign = ifelse(pred.all.together$lambda>0, "+", "-") pred.all.together$lambdaSign = ifelse(pred.all.together$lambda>0, "+", "-")
pred.all.together[-which(pred.all.together$sp == "Rubus chamaemorus"), ] %>% pred.all.together[-which(pred.all.together$sp == "Rubus chamaemorus"), ] %>%
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment