Learn R Programming

lmomRFA (version 3.8)

regdata: The regdata class

Description

An object of class "regdata" stores summary statistics of the data for the sites in a region. It is a data frame with each row containing data for one site. The columns should contain the site name, record length and \(L\)-moments and \(L\)-moment ratios, in the order \(\ell_1\) (mean), \(t\) (\(L\)-CV), \(t_3\) (\(L\)-skewness), \(t_4\) (\(L\)-kurtosis), \(t_5\), \(t_6\), etc.

There should be at least four columns, but most functions that use objects of class "regdata" typically require more columns. Six or seven columns (4 or 5 \(L\)-moments) is usually adequate for regional frequency analysis.

Note that the fourth column should contain values of the \(L\)-CV \(t=\ell_2/\ell_1\), not the \(L\)-scale \(\ell_2\)!

Objects of class "regdata" are created by as.regdata, and by regsamlmu (with default settings of its arguments). They are used by several functions in package lmomRFA, including regavlmom (which computes regional average \(L\)-moments), regfit (which fits a regional frequency distribution), and regtst (which computes discordancy, heterogeneity and goodness-of-fit measures).

Usage

as.regdata(x, warn.names=TRUE)

Value

An object of class "regdata".

Arguments

x

R object.

warn.names

Logical: if TRUE, warnings are issued if the column names of x appear to be inconsistent with what is expected for an object of class "regdata".

Author

J. R. M. Hosking jrmhosking@gmail.com

Details

as.regdata converts an R object to class "regdata". Only data frames and numeric matrices can be converted.

Examples

Run this code
Cascades        # 'Cascades' is of class "regdata"

# Create a data frame with site statistics
dd<-data.frame(
  name      =c("site 1", "site 2", "site 3"),
  n         =c(  20,   30,   40),
  mean      =c( 100,  110,  120),
  LCV       =c(0.20, 0.25, 0.30),
  L_skewness=c(0.15, 0.20, 0.25),
  L_kurtosis=c(0.10, 0.15, 0.20),
  t_5       =c(0.10, 0.12, 0.14))
# Convert to class "regdata"
rdd<-as.regdata(dd)
rdd
class(rdd)

Run the code above in your browser using DataLab