HOWTO_WRITE_A_MODEL 1.29 KB
Newer Older
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

1. Copy src/models/skel.h to src/models/your_model_name.h

2. replace all occurence of MODEL in src/models/your_model_name.h by
   your_model_name
   e.g. sed -r 's/MODEL/your_model_name/g' -i src/models/your_model_name.h

3. Edit the file src/models/your_model_name.h, following instructions in
   comments

4. Edit src/dispatcher.h you must 
    - add your model/your_model_name.h in includes
    - add 3 line (and one blank line) in the dispatcher model, search bernoulli
      and poisson to understand

5. Edit src/Makevars, add -Wall to PKG_CPPFLAGS

6. Compile your code. As your modification are in .h files, you must touch the
19
   file src/dispatcher.cc at each recompilation to force recompilation.
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
20 21 22 23 24 25 26 27 28 29 30 31

   cd ..
   touch blockmodels/src/dispatcher.cc
   R CMD INSTALL blockmodels

   If you want to submit your model, the compilation must be done WITHOUT any
   warnings.

7. Write R RefClass for the model, inheriting from scalar_model,
   scalar_model_with_covarariates, multivariate_model, ... or model directly if you
   want.

Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
32
8. Write R documentation file and tests.
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
33

Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
34 35 36 37 38 39
   * write code in orig/code/your_model_name.R. Use variables as others.

   * write man with macro in orig/man/your_model_name.Rd. Use variables as
     others.

   * run ./gen_mans_and_tests
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
40 41

9. Set export of you model in NAMESPACE.