goldingn / pop

A Flexible Syntax for Population Dynamic Modelling :koala: :chart_with_upwards_trend:
Other
10 stars 2 forks source link

make transfuns functions of other parameters #5

Closed goldingn closed 8 years ago

goldingn commented 8 years ago

these could be environmental (patch quality), demographic (population density) or trait based (depending on size etc.) though encoding traits will be trickier

goldingn commented 8 years ago

Starting with patch features (including density) and focussing on the transfun side of things to start with:

All transfuns should take the ... (dots) argument, and may use the following variables that will be passed in: density - a named vector corresponding to the population vector for that patch (and calculated as population / area) features - a named vector giving the values of some features of the patch (e.g. 'quality', temperature, landcover type etc.)

Users can then define their own transfuns as R functions, using the function zoon::as.transfun(fun, type = c('probability', 'rate')

as.transfun will check to make sure the only argument is dots, and that it returns a numeric vector of length 1.

(later as.transfun can be overloaded to wrap glms, gams etc.)

goldingn commented 8 years ago

Hmmm... dots seems not to work well.

Probably best to define a patch class, with objects containing all of the relevant info instead. transfuns should therefore accept an argument patch

landscape objects (discussed in #7) should therefore contain lists of patches as well as an adjacency matrix