Skip to content

Instantly share code, notes, and snippets.

View MirzaCengic's full-sized avatar

Mirza Cengic MirzaCengic

  • Radboud University, BHHU ATRA
  • Nijmegen
View GitHub Profile
cat("BIOMOD_EnsembleModeling2 loaded", "\n")
BIOMOD_EnsembleModeling2 <- function (modeling.output, chosen.models = "all", em.by = "PA_dataset+repet",
eval.metric = "all", eval.metric.quality.threshold = NULL,
models.eval.meth = c("KAPPA", "TSS", "ROC"), prob.mean = TRUE,
prob.cv = FALSE, prob.ci = FALSE, prob.ci.alpha = 0.05, prob.median = FALSE,
committee.averaging = FALSE, prob.mean.weight = FALSE, prob.mean.weight.decay = "proportional",
VarImport = 0)
{
biomod2:::.bmCat("Build Ensemble Models")
args <- biomod2:::.BIOMOD_EnsembleModeling.check.args(modeling.output,
@MirzaCengic
MirzaCengic / elevation_lines.R
Last active January 7, 2020 23:06
Elevation map in the style of Joy Division's Unknown Pleasures
# Elevation lines map for the #30DayMapChallenge
# Author: Mirza Čengić | mirzaceng@gmail.com
pacman::p_load(Rahat, tidyverse, raster, topo.ridges)
raster_bih <- getData(name = "alt", country = "BA")
raster_bih_agg <- aggregate(raster_bih, fact = 5)
raster_bih_agg[is.na(raster_bih_agg)] <- 0
@MirzaCengic
MirzaCengic / bm_fit.R
Created November 1, 2017 17:11
biomod backcasted model vs. cross-validated
#... cont'd
#### Backcasting part ####
tic("Formating model data")
cat("Formating data for backcasting...", "\n")
model_data <- BIOMOD_FormatingData(resp.var = presabs[, "PA"], expl.var = rasters_region_stack,
eval.resp.var = presabs_eval[, "PA"],
eval.resp.xy = presabs_eval[, c("x", "y")],
resp.xy = presabs[, c("x", "y")],
@MirzaCengic
MirzaCengic / bm_df.R
Last active September 8, 2017 12:17
biomod2 reprex for working with dataframes
library(mapview)
library(raster)
library(dplyr)
library(biomod2)
poppendorf_df <- as.data.frame(poppendorf, xy = TRUE)
poppendorf_df$coords_all <- paste(poppendorf_df$x, poppendorf_df$y, sep = "_")
poppendorf_pts <- sampleRandom(poppendorf, 1000, sp = TRUE)