-
Notifications
You must be signed in to change notification settings - Fork 0
/
poisson_estimation.m
77 lines (73 loc) · 1.59 KB
/
poisson_estimation.m
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
N = 100;
range = 100;
scale = 1;
t = 10;
means = zeros(range,1);
stds = zeros(range,1);
times = zeros(range,1);
counts = zeros(range,1);
mean_stds = zeros(range,1);
std_stds = zeros(range,1);
time_stds = zeros(range,1);
counts_stds = zeros(range,1);
for ind = 1:range
exp_mean = zeros(N,1);
exp_std = zeros(N,1);
exp_time = zeros(N,1);
exp_counts = zeros(N,1);
for j = 1:N
x = randraw('weibull', [0,0.5,1/gamma(1+1/0.5)], scale*ind);
X = cumsum(x);
exp_counts(j) = sum(X<t);
exp_mean(j) = mean(x);
exp_std(j) = std(x);
exp_time(j) = sum(x);
end
means(ind) = mean(exp_mean);
stds(ind) = mean(exp_std);
times(ind) = mean(exp_time);
counts(ind) = mean(exp_counts);
mean_stds(ind) = std(exp_mean);
std_stds(ind) = std(exp_std);
time_stds(ind) = std(exp_time);
counts_stds(ind) = std(exp_counts);
end
close all
set(0,'DefaultAxesFontSize',20)
set(0,'defaultlinelinewidth',2)
figure()
loglog(means)
xlabel('samples')
ylabel('\mu')
figure()
loglog(stds)
xlabel('samples')
ylabel('\sigma')
figure()
loglog(times)
xlabel('samples')
ylabel('time \mu')
figure()
loglog(mean_stds)
xlabel('samples')
ylabel('\mu \sigma')
figure()
loglog(std_stds)
xlabel('samples')
ylabel('\sigma \sigma')
figure()
loglog(time_stds)
xlabel('samples')
ylabel('time \sigma')
figure()
plot(mean_stds./means)
xlabel('samples')
ylabel('\mu % accuracy')
figure()
loglog(counts)
xlabel('samples')
ylabel('counts')
figure()
loglog(mean_stds)
xlabel('samples')
ylabel('counts \sigma')