-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrcpp_sim_vam.h
More file actions
87 lines (61 loc) · 1.91 KB
/
rcpp_sim_vam.h
File metadata and controls
87 lines (61 loc) · 1.91 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef RCPP_SIM_VAM_H
#define RCPP_SIM_VAM_H
#include <Rcpp.h>
#include "rcpp_maintenance_model.h"
//#include "rcpp_stop_policy.h"
using namespace Rcpp ;
class StopPolicy;
class SimVam {
public:
SimVam(List model_) {
model=new VamModel(model_);
};
~SimVam() {
delete model;
};
//This is used inside simulate to fetch last generated data
DataFrame get_last_data();
//The 2 following functions are now similarly used in plot.R than mle.vam and model.vam
//This is just a delagation to model
void set_data(List data_) {
model->set_data(data_);
}
DataFrame get_selected_data(int i) {
return model->get_selected_data(i);
}
//TimeInit and TypeInit are for simulation of the futur of a data set
//for calls of simulate from R with NULL vectors for TimeInit and TypeInit don't forget to write
//something like simulate(10,as.numeric(c()),as.numeric(c())) otherwise there will be an error
DataFrame simulate(int nbsim, NumericVector TimeInit, NumericVector TypeInit);
VamModel* get_model() {
return model;
}
NumericVector get_params() {
return model->get_params();
}
void set_params(NumericVector pars) {
model->set_params(pars);
}
//delegate from model cache!
List get_virtual_age_infos(double by,double from, double to) {
return model->get_virtual_age_infos(by,from,to);
}
void add_stop_policy(List policy);
int cache_size,size;
//Covariates related
void select_current_system(int i) {
model->select_current_system(i,false);
}
double compute_covariates() {
return exp(-model->compute_covariates());
};
void set_covariates(List covariates_) {
model->set_covariates(covariates_);
}
private:
VamModel* model;
StopPolicy* stop_policy;
void init(int cache_size_);
void resize();
};
#endif //RCPP_SIM_VAM_H