Skip to contents

Fit multiple independent generalized Pareto models to each column of a data frame. Edited version of the migpd function in texmex, to allow for NAs in a time series.

Usage

Migpd_Fit(
  Data,
  Data_Full = NA,
  mth,
  mqu,
  penalty = "gaussian",
  maxit = 10000,
  trace = 0,
  verbose = FALSE,
  priorParameters = NULL
)

Arguments

Data

A data frame with n columns, each comprising a declustered and if necessary detrended time series to be modelled.

Data_Full

A data frame with n columns, each comprising the original (detrended if necessary) time series to be modelled. Only required if threshold is specified using mqu.

mth

Marginal thresholds, above which generalized Pareto models are fitted. Numeric vector of length n.

mqu

Marginal quantiles, above which generalized Pareto models are fitted. Only one of mth and mqu should be supplied. Numeric vector of length n.

penalty

How the likelihood should be penalized. Defaults to "gaussian".

maxit

Numeric vector of length specifying the maximum number of iterations used in the optimization. Default is 10000.

trace

Default is 0.

verbose

Default is FALSE.

priorParameters

Prior parameters. Only use if penalty = "gaussian".

Value

An object of class "migpd". There are coef, print, plot, and summary functions available.

Examples

#With date as first column
S22.GPD<-Migpd_Fit(Data=S22.Detrend.Declustered.df,
                   Data_Full=S22.Detrend.df,
                   mqu =c(0.99,0.99,0.99))
#Same GPDs fit as above but thresholds given on the original scale
S22.Rainfall.Quantile<-quantile(na.omit(S22.Detrend.Declustered.df$Rainfall),0.99)
S22.OsWL.Quantile<-quantile(na.omit(S22.Detrend.Declustered.df$OsWL),0.99)
S22.GW.Quantile<-quantile(na.omit(S22.Detrend.Declustered.df$Groundwater),0.99)
S22.GPD<-Migpd_Fit(Data=S22.Detrend.Declustered.df[,-1],
                   Data_Full=S22.Detrend.df[,-1],
                   mth =c(S22.Rainfall.Quantile,S22.OsWL.Quantile,S22.GW.Quantile))