BiologicalRecordsCentre / sparta

Species Presence/Absence R Trends Analyses
http://biologicalrecordscentre.github.io/sparta/index.html
MIT License
21 stars 24 forks source link

Meta-coding the priors #108

Open drnickisaac opened 5 years ago

drnickisaac commented 5 years ago

For a while sparta read the BUGS code direct from a set of pre-prepared text files. @AugustT added greater flexibility in specifying the model by creating a series of Meta-coding functions. The initial hard work is done by getModelFile, which then calls getObsModel. The latter creates BUGS code for the observation model on the fly, with a variety of different options. However, getModelFile still reads the priors directly from a text file: modelScript <- readLines(modelfile)

These text files are stored in a folder inst/models that is not obvious to users. There are currently 12 such files, although I suspect most are obsolete. These files include the original base model and all the variants tested by @CharlieOuthwaite for her PhD upgrade.

Storing the priors in text files reduces our flexibility to make other changes, such as fixing alpha.p across years (#99).

So, to give us the flexibility we need, the tasks are:

drnickisaac commented 5 years ago

See also #60

drnickisaac commented 5 years ago

Duplicates and supersedes #81

JHHatfield commented 5 years ago

According to the function help "intercept" and "centering" options are no longer available. they can however still be used in combination with other options (this is not however clear unless you look at the model files). In addition options such as the example "modeltype = c('indran', 'halfcauchy', 'catlistlength')" given in the help do not exist. If intercept and centering are no longer to be used even in combinations, this would leave only the 2014 sparta and random walk with halfcauchy as options. I think we need to discuss and list which model types are needed, identify which are mutually exclusive etc and decide which the package should provide going forward.

JHHatfield commented 5 years ago

Current prior options - sparta2014, inverse gamma, half-cauchy Year effect options - sparta2014, indran, random walk Model adjustment options - sparta2014, intercept, centering Observation model adjustments - Julian date, no list length, continuous list length, categorical list length