Additional features on fitted model by maximum likelihood that were not included in Coles are also provided. They are presented here for the Port Pirie example.
Loading the annual maximum sea-levels at Port Pirie:
data = Extremes.dataset("portpirie")
first(data,5)
1 1923 4.03 2 1924 3.83 3 1925 3.65 4 1926 3.88 5 1927 4.01
Fitting the GEV parameters by maximum likelihood:
julia> fm = gevfit(data, :SeaLevel)
MaximumLikelihoodAbstractExtremeValueModel
model :
BlockMaxima{GeneralizedExtremeValue}
data : Vector{Float64}[65]
location : μ ~ 1
logscale : ϕ ~ 1
shape : ξ ~ 1
θ̂ : [3.874750223091266, -1.6192723640210762, -0.05010719929448139]
The AIC of the fitted model can be obtained with the function aic
julia> aic(fm)
-2.67811694235429
The BIC of the fitted model can be obtained with the function bic
julia> bic(fm)
3.8450448673326214
df = DataFrame( ξ = Float64[], pl = Float64[])
# Computing the profile loglikelihood for different values of ξ
for ξ in -.3:.01:.3
fobj(θ::DenseVector) = -Extremes.loglike(fm.model, [θ[1], θ[2], ξ])
res = optimize(fobj, [3., 0.])
push!(df, [ξ, -Optim.minimum(res)])
end
set_default_plot_size(12cm, 8cm)
plot(df, x=:ξ, y=:pl, Geom.line, Guide.ylabel("Profile log likelihood"))
ξ
-0.3
-0.2
-0.1
0.0
0.1
0.2
0.3
-0.300
-0.275
-0.250
-0.225
-0.200
-0.175
-0.150
-0.125
-0.100
-0.075
-0.050
-0.025
0.000
0.025
0.050
0.075
0.100
0.125
0.150
0.175
0.200
0.225
0.250
0.275
0.300
-0.302
-0.300
-0.298
-0.296
-0.294
-0.292
-0.290
-0.288
-0.286
-0.284
-0.282
-0.280
-0.278
-0.276
-0.274
-0.272
-0.270
-0.268
-0.266
-0.264
-0.262
-0.260
-0.258
-0.256
-0.254
-0.252
-0.250
-0.248
-0.246
-0.244
-0.242
-0.240
-0.238
-0.236
-0.234
-0.232
-0.230
-0.228
-0.226
-0.224
-0.222
-0.220
-0.218
-0.216
-0.214
-0.212
-0.210
-0.208
-0.206
-0.204
-0.202
-0.200
-0.198
-0.196
-0.194
-0.192
-0.190
-0.188
-0.186
-0.184
-0.182
-0.180
-0.178
-0.176
-0.174
-0.172
-0.170
-0.168
-0.166
-0.164
-0.162
-0.160
-0.158
-0.156
-0.154
-0.152
-0.150
-0.148
-0.146
-0.144
-0.142
-0.140
-0.138
-0.136
-0.134
-0.132
-0.130
-0.128
-0.126
-0.124
-0.122
-0.120
-0.118
-0.116
-0.114
-0.112
-0.110
-0.108
-0.106
-0.104
-0.102
-0.100
-0.098
-0.096
-0.094
-0.092
-0.090
-0.088
-0.086
-0.084
-0.082
-0.080
-0.078
-0.076
-0.074
-0.072
-0.070
-0.068
-0.066
-0.064
-0.062
-0.060
-0.058
-0.056
-0.054
-0.052
-0.050
-0.048
-0.046
-0.044
-0.042
-0.040
-0.038
-0.036
-0.034
-0.032
-0.030
-0.028
-0.026
-0.024
-0.022
-0.020
-0.018
-0.016
-0.014
-0.012
-0.010
-0.008
-0.006
-0.004
-0.002
0.000
0.002
0.004
0.006
0.008
0.010
0.012
0.014
0.016
0.018
0.020
0.022
0.024
0.026
0.028
0.030
0.032
0.034
0.036
0.038
0.040
0.042
0.044
0.046
0.048
0.050
0.052
0.054
0.056
0.058
0.060
0.062
0.064
0.066
0.068
0.070
0.072
0.074
0.076
0.078
0.080
0.082
0.084
0.086
0.088
0.090
0.092
0.094
0.096
0.098
0.100
0.102
0.104
0.106
0.108
0.110
0.112
0.114
0.116
0.118
0.120
0.122
0.124
0.126
0.128
0.130
0.132
0.134
0.136
0.138
0.140
0.142
0.144
0.146
0.148
0.150
0.152
0.154
0.156
0.158
0.160
0.162
0.164
0.166
0.168
0.170
0.172
0.174
0.176
0.178
0.180
0.182
0.184
0.186
0.188
0.190
0.192
0.194
0.196
0.198
0.200
0.202
0.204
0.206
0.208
0.210
0.212
0.214
0.216
0.218
0.220
0.222
0.224
0.226
0.228
0.230
0.232
0.234
0.236
0.238
0.240
0.242
0.244
0.246
0.248
0.250
0.252
0.254
0.256
0.258
0.260
0.262
0.264
0.266
0.268
0.270
0.272
0.274
0.276
0.278
0.280
0.282
0.284
0.286
0.288
0.290
0.292
0.294
0.296
0.298
0.300
0.302
-0.3
0.0
0.3
h,j,k,l,arrows,drag to pan
i,o,+,-,scroll,shift-drag to zoom
r,dbl-click to reset
c for coordinates
? for help
?
-1
0
1
2
3
4
5
-1.00
-0.75
-0.50
-0.25
0.00
0.25
0.50
0.75
1.00
1.25
1.50
1.75
2.00
2.25
2.50
2.75
3.00
3.25
3.50
3.75
4.00
4.25
4.50
4.75
5.00
-1.00
-0.98
-0.96
-0.94
-0.92
-0.90
-0.88
-0.86
-0.84
-0.82
-0.80
-0.78
-0.76
-0.74
-0.72
-0.70
-0.68
-0.66
-0.64
-0.62
-0.60
-0.58
-0.56
-0.54
-0.52
-0.50
-0.48
-0.46
-0.44
-0.42
-0.40
-0.38
-0.36
-0.34
-0.32
-0.30
-0.28
-0.26
-0.24
-0.22
-0.20
-0.18
-0.16
-0.14
-0.12
-0.10
-0.08
-0.06
-0.04
-0.02
0.00
0.02
0.04
0.06
0.08
0.10
0.12
0.14
0.16
0.18
0.20
0.22
0.24
0.26
0.28
0.30
0.32
0.34
0.36
0.38
0.40
0.42
0.44
0.46
0.48
0.50
0.52
0.54
0.56
0.58
0.60
0.62
0.64
0.66
0.68
0.70
0.72
0.74
0.76
0.78
0.80
0.82
0.84
0.86
0.88
0.90
0.92
0.94
0.96
0.98
1.00
1.02
1.04
1.06
1.08
1.10
1.12
1.14
1.16
1.18
1.20
1.22
1.24
1.26
1.28
1.30
1.32
1.34
1.36
1.38
1.40
1.42
1.44
1.46
1.48
1.50
1.52
1.54
1.56
1.58
1.60
1.62
1.64
1.66
1.68
1.70
1.72
1.74
1.76
1.78
1.80
1.82
1.84
1.86
1.88
1.90
1.92
1.94
1.96
1.98
2.00
2.02
2.04
2.06
2.08
2.10
2.12
2.14
2.16
2.18
2.20
2.22
2.24
2.26
2.28
2.30
2.32
2.34
2.36
2.38
2.40
2.42
2.44
2.46
2.48
2.50
2.52
2.54
2.56
2.58
2.60
2.62
2.64
2.66
2.68
2.70
2.72
2.74
2.76
2.78
2.80
2.82
2.84
2.86
2.88
2.90
2.92
2.94
2.96
2.98
3.00
3.02
3.04
3.06
3.08
3.10
3.12
3.14
3.16
3.18
3.20
3.22
3.24
3.26
3.28
3.30
3.32
3.34
3.36
3.38
3.40
3.42
3.44
3.46
3.48
3.50
3.52
3.54
3.56
3.58
3.60
3.62
3.64
3.66
3.68
3.70
3.72
3.74
3.76
3.78
3.80
3.82
3.84
3.86
3.88
3.90
3.92
3.94
3.96
3.98
4.00
4.02
4.04
4.06
4.08
4.10
4.12
4.14
4.16
4.18
4.20
4.22
4.24
4.26
4.28
4.30
4.32
4.34
4.36
4.38
4.40
4.42
4.44
4.46
4.48
4.50
4.52
4.54
4.56
4.58
4.60
4.62
4.64
4.66
4.68
4.70
4.72
4.74
4.76
4.78
4.80
4.82
4.84
4.86
4.88
4.90
4.92
4.94
4.96
4.98
5.00
-5
0
5
Profile log likelihood
# 95% quantile of the Chi squared distribution with one degree of freedom
c = quantile(Chisq(1), .95)
# Maximum and maximum position of the profile log likelihood
fm = findmax(df.pl)
# High for the confidence interval
h = fm[1]-.5*c
# left bound
l = argmin(abs.(h.-df.pl[1:fm[2]]))
# right bound
r = fm[2] -1 + argmin(abs.(h.-df.pl[fm[2]:end]))
plot(df, x=:ξ, y=:pl, Geom.line,
xintercept=[df.ξ[l], df.ξ[r]], Geom.vline(color="red", style=:dash),
yintercept = [fm[1], h], Geom.hline(color="red", style=:dash),
Guide.ylabel("Profile log likelihood"))
ξ
-0.3
-0.2
-0.1
0.0
0.1
0.2
0.3
-0.300
-0.275
-0.250
-0.225
-0.200
-0.175
-0.150
-0.125
-0.100
-0.075
-0.050
-0.025
0.000
0.025
0.050
0.075
0.100
0.125
0.150
0.175
0.200
0.225
0.250
0.275
0.300
-0.302
-0.300
-0.298
-0.296
-0.294
-0.292
-0.290
-0.288
-0.286
-0.284
-0.282
-0.280
-0.278
-0.276
-0.274
-0.272
-0.270
-0.268
-0.266
-0.264
-0.262
-0.260
-0.258
-0.256
-0.254
-0.252
-0.250
-0.248
-0.246
-0.244
-0.242
-0.240
-0.238
-0.236
-0.234
-0.232
-0.230
-0.228
-0.226
-0.224
-0.222
-0.220
-0.218
-0.216
-0.214
-0.212
-0.210
-0.208
-0.206
-0.204
-0.202
-0.200
-0.198
-0.196
-0.194
-0.192
-0.190
-0.188
-0.186
-0.184
-0.182
-0.180
-0.178
-0.176
-0.174
-0.172
-0.170
-0.168
-0.166
-0.164
-0.162
-0.160
-0.158
-0.156
-0.154
-0.152
-0.150
-0.148
-0.146
-0.144
-0.142
-0.140
-0.138
-0.136
-0.134
-0.132
-0.130
-0.128
-0.126
-0.124
-0.122
-0.120
-0.118
-0.116
-0.114
-0.112
-0.110
-0.108
-0.106
-0.104
-0.102
-0.100
-0.098
-0.096
-0.094
-0.092
-0.090
-0.088
-0.086
-0.084
-0.082
-0.080
-0.078
-0.076
-0.074
-0.072
-0.070
-0.068
-0.066
-0.064
-0.062
-0.060
-0.058
-0.056
-0.054
-0.052
-0.050
-0.048
-0.046
-0.044
-0.042
-0.040
-0.038
-0.036
-0.034
-0.032
-0.030
-0.028
-0.026
-0.024
-0.022
-0.020
-0.018
-0.016
-0.014
-0.012
-0.010
-0.008
-0.006
-0.004
-0.002
0.000
0.002
0.004
0.006
0.008
0.010
0.012
0.014
0.016
0.018
0.020
0.022
0.024
0.026
0.028
0.030
0.032
0.034
0.036
0.038
0.040
0.042
0.044
0.046
0.048
0.050
0.052
0.054
0.056
0.058
0.060
0.062
0.064
0.066
0.068
0.070
0.072
0.074
0.076
0.078
0.080
0.082
0.084
0.086
0.088
0.090
0.092
0.094
0.096
0.098
0.100
0.102
0.104
0.106
0.108
0.110
0.112
0.114
0.116
0.118
0.120
0.122
0.124
0.126
0.128
0.130
0.132
0.134
0.136
0.138
0.140
0.142
0.144
0.146
0.148
0.150
0.152
0.154
0.156
0.158
0.160
0.162
0.164
0.166
0.168
0.170
0.172
0.174
0.176
0.178
0.180
0.182
0.184
0.186
0.188
0.190
0.192
0.194
0.196
0.198
0.200
0.202
0.204
0.206
0.208
0.210
0.212
0.214
0.216
0.218
0.220
0.222
0.224
0.226
0.228
0.230
0.232
0.234
0.236
0.238
0.240
0.242
0.244
0.246
0.248
0.250
0.252
0.254
0.256
0.258
0.260
0.262
0.264
0.266
0.268
0.270
0.272
0.274
0.276
0.278
0.280
0.282
0.284
0.286
0.288
0.290
0.292
0.294
0.296
0.298
0.300
0.302
-0.3
0.0
0.3
h,j,k,l,arrows,drag to pan
i,o,+,-,scroll,shift-drag to zoom
r,dbl-click to reset
c for coordinates
? for help
?
-1
0
1
2
3
4
5
-1.00
-0.75
-0.50
-0.25
0.00
0.25
0.50
0.75
1.00
1.25
1.50
1.75
2.00
2.25
2.50
2.75
3.00
3.25
3.50
3.75
4.00
4.25
4.50
4.75
5.00
-1.00
-0.98
-0.96
-0.94
-0.92
-0.90
-0.88
-0.86
-0.84
-0.82
-0.80
-0.78
-0.76
-0.74
-0.72
-0.70
-0.68
-0.66
-0.64
-0.62
-0.60
-0.58
-0.56
-0.54
-0.52
-0.50
-0.48
-0.46
-0.44
-0.42
-0.40
-0.38
-0.36
-0.34
-0.32
-0.30
-0.28
-0.26
-0.24
-0.22
-0.20
-0.18
-0.16
-0.14
-0.12
-0.10
-0.08
-0.06
-0.04
-0.02
0.00
0.02
0.04
0.06
0.08
0.10
0.12
0.14
0.16
0.18
0.20
0.22
0.24
0.26
0.28
0.30
0.32
0.34
0.36
0.38
0.40
0.42
0.44
0.46
0.48
0.50
0.52
0.54
0.56
0.58
0.60
0.62
0.64
0.66
0.68
0.70
0.72
0.74
0.76
0.78
0.80
0.82
0.84
0.86
0.88
0.90
0.92
0.94
0.96
0.98
1.00
1.02
1.04
1.06
1.08
1.10
1.12
1.14
1.16
1.18
1.20
1.22
1.24
1.26
1.28
1.30
1.32
1.34
1.36
1.38
1.40
1.42
1.44
1.46
1.48
1.50
1.52
1.54
1.56
1.58
1.60
1.62
1.64
1.66
1.68
1.70
1.72
1.74
1.76
1.78
1.80
1.82
1.84
1.86
1.88
1.90
1.92
1.94
1.96
1.98
2.00
2.02
2.04
2.06
2.08
2.10
2.12
2.14
2.16
2.18
2.20
2.22
2.24
2.26
2.28
2.30
2.32
2.34
2.36
2.38
2.40
2.42
2.44
2.46
2.48
2.50
2.52
2.54
2.56
2.58
2.60
2.62
2.64
2.66
2.68
2.70
2.72
2.74
2.76
2.78
2.80
2.82
2.84
2.86
2.88
2.90
2.92
2.94
2.96
2.98
3.00
3.02
3.04
3.06
3.08
3.10
3.12
3.14
3.16
3.18
3.20
3.22
3.24
3.26
3.28
3.30
3.32
3.34
3.36
3.38
3.40
3.42
3.44
3.46
3.48
3.50
3.52
3.54
3.56
3.58
3.60
3.62
3.64
3.66
3.68
3.70
3.72
3.74
3.76
3.78
3.80
3.82
3.84
3.86
3.88
3.90
3.92
3.94
3.96
3.98
4.00
4.02
4.04
4.06
4.08
4.10
4.12
4.14
4.16
4.18
4.20
4.22
4.24
4.26
4.28
4.30
4.32
4.34
4.36
4.38
4.40
4.42
4.44
4.46
4.48
4.50
4.52
4.54
4.56
4.58
4.60
4.62
4.64
4.66
4.68
4.70
4.72
4.74
4.76
4.78
4.80
4.82
4.84
4.86
4.88
4.90
4.92
4.94
4.96
4.98
5.00
-5
0
5
Profile log likelihood
The corresponding 95% confidence interval for ξ based on the profile log likelihood is the following:
julia> println("[", df.ξ[l]," , " , df.ξ[r] , "]")
[-0.22 , 0.17]