## *gev -
xmpExtremes("Start: GEV Frechet >")
# Create and plot 1000 GEV/Frechet distributed rdv:
par(mfrow = c(3, 3))
r = rgev(n = 1000, xi = 1)
plot(r, type = "l", main = "GEV/Frechet Series")
## Plot empirical density and compare with true density:
## Omit values greater than 500 from plot
hist(r[r<10], n = 25, probability = TRUE, xlab = "r",
xlim = c(-5, 5), ylim = c(0, 1.1), main = "Density")
x = seq(-5, 5, by=0.01)
lines(x, dgev(x, xi = 1), col = 2)
## Plot df and compare with true df:
plot(sort(r), (1:length(r)/length(r)),
xlim = c(-3, 6), ylim = c(0, 1.1),
cex = 0.5, ylab = "p", xlab = "q", main = "Probability")
q = seq(-5,5, by=0.1)
lines(q, pgev(q, xi=1), col=2)
## Compute quantiles, a test:
qgev(pgev(seq(-5, 5, 0.25), xi = 1), xi = 1)
## *gev -
xmpExtremes("Next: GEV Gumbel >")
# Create and plot 1000 Gumbel distributed rdv:
##> r = rgev(n = 1000, xi = 0)
##> plot(r, type = "l", main = "Gumbel Series")
## Plot empirical density and compare with true density:
##>hist(r[abs(r)<10], nclass = 25, freq = FALSE, xlab = "r",
##> xlim = c(-5,5), ylim = c(0,1.1), main = "Density")
##>x = seq(-5, 5, by = 0.01)
##>lines(x, dgev(x, xi = 0), col=2)
## Plot df and compare with true df:
##>plot(sort(r), (1:length(r)/length(r)),
##> xlim = c(-3, 6), ylim = c(0, 1.1),
##> cex=0.5, ylab = "p", xlab="q", main="Probability")
##>q = seq(-5, 5, by = 0.1)
##>lines(q, pgev(q, xi = 0), col = 2)
## Compute quantiles, a test:
##>qgev(pgev(seq(-5, 5, 0.25), xi = 0), xi = 0)
## *gev -
xmpExtremes("Next: GEV Weibull >")
# Create and plot 1000 Weibull distributed rdv:
r = rgev(n = 1000, xi = -1)
plot(r, type = "l", main = "Weibull Series")
## Plot empirical density and compare with true density:
hist(r[abs(r)<10], nclass = 25, freq = FALSE, xlab = "r",
xlim=c(-5,5), ylim=c(0,1.1), main="Density")
x = seq(-5, 5, by=0.01)
lines(x, dgev(x, xi = -1), col = 2)
## Plot df and compare with true df:
plot(sort(r), (1:length(r)/length(r)),
xlim = c(-3, 6), ylim = c(0, 1.1),
cex = 0.5, ylab = "p", xlab = "q", main = "Probability")
q=seq(-5, 5, by = 0.1)
lines(q, pgev(q, xi = -1), col = 2)
## Compute quantiles, a test:
qgev(pgev(seq(-5, 5, 0.25), xi = -1), xi = -1)Run the code above in your browser using DataLab