1
+ function Base. show (io:: IO , est:: EstimationStatsSDM )
2
+ println (" --------------------------------------------------------" )
3
+ println (" log-likelihood: " , @sprintf (" %.4f" , est. loglikelihood))
4
+ println (" np: " , Int (est. np))
5
+ println (" AIC: " , @sprintf (" %.4f" , est. aic))
6
+ println (" BIC: " , @sprintf (" %.4f" , est. bic))
7
+ print_coefs_stats (est. coefs_stats)
8
+ return nothing
9
+ end
10
+
11
+ function print_coefs_stats (coefs_stats)
12
+ println (" --------------------------------------------------------" )
13
+ println (" Parameter Estimate Std.Error t stat p-value" )
14
+ offset = 1
15
+ for i in coefs_stats. unknowns. ω
16
+ p_c, p_std, p_t_stat, p_p_val = print_coefs_sta (coefs_stats, offset)
17
+ p = build_print (p_c, p_std, p_t_stat, p_p_val, " ω_$i " )
18
+ println (p)
19
+ offset += 1
20
+ end
21
+ for k in sort (collect (keys (coefs_stats. unknowns. A)))
22
+ for i in coefs_stats. unknowns. A[k]
23
+ p_c, p_std, p_t_stat, p_p_val = print_coefs_sta (coefs_stats, offset)
24
+ ind = round (Int, sqrt (i))
25
+ p = build_print (p_c, p_std, p_t_stat, p_p_val, " A_$(k) _$ind$ind " )
26
+ println (p)
27
+ offset += 1
28
+ end
29
+ end
30
+ for k in sort (collect (keys (coefs_stats. unknowns. B)))
31
+ for i in coefs_stats. unknowns. B[k]
32
+ p_c, p_std, p_t_stat, p_p_val = print_coefs_sta (coefs_stats, offset)
33
+ ind = round (Int, sqrt (i))
34
+ p = build_print (p_c, p_std, p_t_stat, p_p_val, " B_$(k) _$ind$ind " )
35
+ println (p)
36
+ offset += 1
37
+ end
38
+ end
39
+ return nothing
40
+ end
41
+
42
+ function print_coefs_sta (sta, offset:: Int )
43
+ p_c = @sprintf (" %.4f" , sta. coefs[offset])
44
+ p_std = @sprintf (" %.4f" , sta. std_errors[offset])
45
+ p_t_stat = @sprintf (" %.4f" , sta. t_stat[offset])
46
+ p_p_val = @sprintf (" %.4f" , sta. p_values[offset])
47
+ return p_c, p_std, p_t_stat, p_p_val
48
+ end
49
+
50
+ function build_print (p_c, p_std, p_t_stat, p_p_val, param)
51
+ p = " "
52
+ p *= param
53
+ p *= " " ^ max (0 , 23 - length (p_c) - length (param))
54
+ p *= p_c
55
+ p *= " " ^ max (0 , 12 - length (p_std))
56
+ p *= p_std
57
+ p *= " " ^ max (0 , 11 - length (p_t_stat))
58
+ p *= p_t_stat
59
+ p *= " " ^ max (0 , 10 - length (p_p_val))
60
+ p *= p_p_val
61
+ return p
62
+ end
0 commit comments