Revision 32, 0.7 kB
(checked in by smidl, 16 years ago)
|
test KF : estimation of R in KF is not possible! Likelihood of y_t is growing when R -> 0
|
Rev | Line | |
---|
[8] | 1 | #include <itpp/itbase.h> |
---|
[19] | 2 | #include <estim/libPF.h> |
---|
| 3 | #include <math/libDC.h> |
---|
| 4 | #include <stat/libEF.h> |
---|
[8] | 5 | |
---|
| 6 | using namespace itpp; |
---|
| 7 | |
---|
| 8 | //These lines are needed for use of cout and endl |
---|
| 9 | using std::cout; |
---|
| 10 | using std::endl; |
---|
| 11 | |
---|
| 12 | int main() { |
---|
| 13 | |
---|
| 14 | RV x("1"); |
---|
[32] | 15 | RV xm=x; xm.t(-1);const |
---|
[8] | 16 | RV y("2"); |
---|
| 17 | |
---|
| 18 | mat A = "1"; |
---|
[19] | 19 | vec vR = "1"; |
---|
| 20 | ldmat R(vR); |
---|
[32] | 21 | |
---|
| 22 | eEmp emp(x,10); |
---|
| 23 | euni eun(x); |
---|
| 24 | eun.set_parameters("0","1"); |
---|
| 25 | emp.set_parameters(ones(10),&eun); |
---|
| 26 | vec &v=emp._w(); |
---|
| 27 | Array<vec> &S=emp._samples(); |
---|
[8] | 28 | |
---|
[32] | 29 | for (int i=0;i<10;i++){ v(i) = exp(-0.5*sum(pow(S(i)-1,2.0))*10);} |
---|
| 30 | v/=sum(v); |
---|
[11] | 31 | |
---|
[32] | 32 | cout << "p:" << S << endl; |
---|
| 33 | cout << "w:" << v << endl; |
---|
[11] | 34 | |
---|
[32] | 35 | ivec ind = emp.resample(); |
---|
[11] | 36 | |
---|
| 37 | cout << ind << endl; |
---|
[8] | 38 | |
---|
| 39 | //Exit program: |
---|
| 40 | return 0; |
---|
| 41 | |
---|
| 42 | } |
---|