knitr::opts_chunk$set(echo = TRUE) library(MetaLandSim) library(plyr) library(dplyr) library(ggplot2) library(pander) library(MetaLandSim)
# Loading all population data # Output from IBM model df.pop <- read.csv2("c:/temp/output.txt", sep = ",") str(df.pop) summary(df.pop) nTimeStep <- dplyr::n_distinct(df.pop$timestep)
Number of patches: r dplyr::n_distinct(df.pop$patch)
Number of timesteps: r nTimeStep
Number of unique individuals: r dplyr::n_distinct(df.pop$ID)
Assumptions:
p <- 0.5 # Detection probability v.Obs <- seq(20, 50, 5) # Observation time steps
Parameters:
detection probability r p
Presence / absencce detection `
df.ObsFlat <- data.frame() for (i in v.Obs) { df.temp <- df.pop %>% dplyr::filter(timestep == i, age > 1) %>% dplyr::sample_frac(p, replace = FALSE) %>% dplyr::select(patch, timestep) %>% dplyr::count(patch) %>% cbind(i) df.ObsFlat <- rbind(df.ObsFlat, df.temp) } str(df.ObsFlat) df.Obs <- df.ObsFlat %>% dplyr::mutate(PA = min(n)) %>% dplyr::select(patch, i, PA) %>% tidyr::spread(i, PA, fill = 0) data(occ.landscape) str(occ.landscape) parameter.estimate(sp = occ.landscape, method = "Rsnap_1", alpha = FALSE, nsnap = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.