-
Notifications
You must be signed in to change notification settings - Fork 2
/
HOWTO_WRITE_A_MODEL
41 lines (27 loc) · 1.29 KB
/
HOWTO_WRITE_A_MODEL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
file src/dispatcher.cc at each recompilation to force recompilation.
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.
8. Write R documentation file and tests.
* 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
9. Set export of you model in NAMESPACE.