Skip to content

Commit

Permalink
Prepare for CRAN resubmission
Browse files Browse the repository at this point in the history
  • Loading branch information
miguel-porto committed Aug 17, 2017
1 parent 481e663 commit 771121e
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 16 deletions.
11 changes: 6 additions & 5 deletions SiMRiv/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: SiMRiv
Version: 1.0.1
Date: 2017-07-24
Date: 2017-08-17
Title: Individual-Based, Spatially-Explicit Simulation and Analysis of Multi-State Movements in River Networks, Homogeneous, and Heterogeneous Landscapes
Authors@R: c(person("Lorenzo", "Quaglietta", role = c("aut"), email = "[email protected]")
,person("Miguel", "Porto", role = c("aut", "cre"), email = "[email protected]")
Expand All @@ -19,10 +19,11 @@ Description: Provides functions to generate and analyze individual-based spatial
mainly along rivers but also using the matrix), or even in highly contrasted landscapes
(e.g. fish in a river network). The algorithm and its input parameters are the same for all
cases, so that results are comparable. Simulated trajectories can then be used as mechanistic
null models to test e.g. for species site fidelity and other 'Movement Ecology' hypotheses, or
for other predictive purposes. The package should thus be relevant to explore a broad spectrum
of ecological phenomena, such as those at the interface of animal behaviour, landscape, spatial
and movement ecology, disease and invasive species spread, and population dynamics.
null models to test e.g. for species site fidelity and other 'Movement Ecology' hypotheses
(Nathan et al. 2008, <DOI:10.1073/pnas.0800375105>), or for other predictive purposes.
The package should thus be relevant to explore a broad spectrum of ecological phenomena, such as those at the interface
of animal behaviour, landscape, spatial and movement ecology, disease and invasive species spread, and population dynamics.
License: GPL (>= 2)
URL: https://www.r-project.org, https://github.com/miguel-porto/SiMRiv
BugReports: https://github.com/miguel-porto/SiMRiv

14 changes: 8 additions & 6 deletions SiMRiv/man/adjustModel.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
This function finds possible parameters for the simulation (solutions), so that the resulting movements are as similar as possible
to the given real trajectory, in terms of their intrinsic properties measured by step lengths and variation in turning angles. The input parameter
approximations are found using a multiobjective genetic algorithm (NSGA-II, \cite{Deb et al. 2002}). The algorithm minimizes a vector
of N objectives (\code{N=sum(nbins.hist)} if \code{aggregate.obj.hist == FALSE}, \code{N=sum(nbins.hist > 0)} otherwise)
of N objectives (N=sum(nbins.hist) if aggregate.obj.hist == FALSE, N=sum(nbins.hist > 0) otherwise)
whose values are computed by the absolute differences between each pair of bins (real and simulated) of two histograms:
an histogram of the step lengths and an histogram of either the turning angles themselves (if \code{TA.variation == FALSE}), or of the
standard deviation in turning angles computed in a moving time window along each trajectory (if \code{TA.variation == TRUE}).
Expand Down Expand Up @@ -127,15 +127,17 @@ species.model <- speciesModel("CRW.CRW.sl", steplength = max.step.length)

## now run optimization

sol <- adjustModel(real.data, species.model, resol = 20, window = 10, nbins.hist = c(3, 3)
, step.hist.log = TRUE)
sol <- adjustModel(real.data, species.model, resol = 20, window = 10
, nbins.hist = c(3, 3), step.hist.log = TRUE)

## After finishing, we can extract the input parameters of the optimized solutions
## (100 by default) in the last generation (generation 1000 by default):
## After finishing, we can extract the input parameters of the optimized
## solutions (100 by default) in the last generation (generation 1000
## by default):

pars <- sol[[length(sol)]]$par

## now we can take the optimized solutions and reconstruct species based on them:
## now we can take the optimized solutions and reconstruct species
## based on them:

optimized.species <- apply(pars, 1, species.model)

Expand Down
5 changes: 3 additions & 2 deletions SiMRiv/man/generationPlot.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
Plots the evolution of the optimized solutions (sets of input parameters) along the \code{\link{adjustModel}} algorithm's generations.
}
\usage{
generationPlot(solutions, species.model, plot.quantiles = c(0.10, 0.5, 0.90)
, only.pareto = FALSE, show.legend = TRUE, lwd = 1.5, mar = c(2.3, 2.3, 0.2, 2.3)
generationPlot(solutions, species.model
, plot.quantiles = c(0.10, 0.5, 0.90), only.pareto = FALSE
, show.legend = TRUE, lwd = 1.5, mar = c(2.3, 2.3, 0.2, 2.3)
, mgp = c(1.2, 0.2, 0), tcl = -0.25, ...)
}
\arguments{
Expand Down
3 changes: 2 additions & 1 deletion SiMRiv/man/species.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
Creates a species, characterized by one or more behavioral states, to be simulated with function \code{\link{simulate}}.
}
\usage{
species(states, trans = transitionMatrix(), name = "<unnamed>", resistanceMap = NULL)
species(states, trans = transitionMatrix(), name = "<unnamed>"
, resistanceMap = NULL)
}
\arguments{
\item{states}{a list of \code{state}s characterizing the behavior of the species, or a single \code{state}, for simple movements}
Expand Down
3 changes: 2 additions & 1 deletion SiMRiv/man/speciesModel.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
\arguments{
\item{type}{the type of movement to "fit". One of \code{CRW}, \code{RW.CRW}, \code{CRW.CRW}, \code{RW.CRW.sl}, \code{CRW.CRW.sl}}
\item{perceptual.range}{the perceptual range for all states.}
\item{steplength}{the fixed step length for fixed step length types \code{CRW}, \code{RW.CRW}, \code{CRW.CRW} or the maximum allowed value for variable step length types \code{RW.CRW.sl}, \code{CRW.CRW.sl}.}
\item{steplength}{the fixed step length for fixed step length types \code{CRW}, \code{RW.CRW}, \code{CRW.CRW} or the maximum allowed value for variable step length types \code{RW.CRW.sl}
, \code{CRW.CRW.sl}, \code{CRW.CRW.CRW.sl} and \code{CRW.RW.Rest.sl}.}
\item{prob.upperbound}{the maximum allowed value for the state switching probabilities. The default is 0.5 because very high state switching probabilities don't make much sense from a biological point of view.}
\item{max.concentration}{the maximum allowed value for the turning angle concentration parameter for CRWs [0, 1]. By default it is set to 0.99 because values higher than this (for technical reasons) result in straight line paths, which is a technical artifact.}
}
Expand Down
2 changes: 1 addition & 1 deletion SiMRiv/src/simulate.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// FIXME: some bug with OMP in i386 architecture...
#define USEOPENMP
//#define USEOPENMP
#ifdef USEOPENMP
#include <omp.h>
#endif
Expand Down

0 comments on commit 771121e

Please sign in to comment.