Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % I use this code to obtain the false positive rate of the nonparametric cusum algorithm
- max_iter = 1000;
- taoval = 1:0.5:200; %taoval means \tau, which is the threshold
- false_pos = zeros(size(taoval));
- for itao = 1:length(taoval)
- tao = taoval(itao);
- num = 0;
- for is = 1:100 % the number of the normal data are 100
- flag = 0;
- Si_1 = 0;
- Si1 = 0;
- for i = 1:max_iter
- Si1 = Si_1+0.1*abs(randn(1)); %Si1 is the the nonparametric cusum algorithm statistics, 0.1 decides the power of the attack
- if(i>100)
- Si1 = Si1+0.5*94.20; %94.20 is the \gamma?percentiles of z3, which is derived from historical data. 0.5 means the true value is changed by 50%
- end
- if(Si1>tao)
- flag = 1;
- break;
- end
- Si_1 = Si1;
- end
- if(flag)
- num = num+1;
- end
- end
- false_pos(itao) = num/100; %false_pos(i) is the false positive rate
- end
- figure;
- plot(taoval,false_pos,'b-','linewidth',4);
- xlabel('\tau');
- ylabel('False Positive Rate');
- title('z_{4}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement