Description Usage Arguments Details Value Examples
THe Omega.GLS
function calculates the weighting matrix
required for generalized least-squares regression, without or without
uncertainty in the regional skew.
1 2 |
alpha |
A number, required only for “GLS” and “GLSskew”.
|
theta |
A number, required only for “GLS” and “GLSskew”.
|
independent |
A dataframe containing three variables: |
X |
The independent variables in the regression, with any transformations
already applied. Each row represents a site and each column represents a
particular independe variable. (If a leading constant is used, it should be
included here as a leading column of ones.) The rows must be in the same
order as the dependent variables in |
Y |
The dependent variable of interest, with any transformations already applied. |
recordLengths |
This input is required. #' |
LP3 |
A dataframe containing the fitted Log-Pearson Type III standard
deviate, standard deviation and skew for each site. The names of this data
frame are |
MSEGR |
A number. The mean squared error of the regional skew. Required only for “GLSskew”. |
TY |
A number. The return period of the event being modeled. Required
only for “GLSskew”. The default value is |
peak |
A logical. Indicates if the event being modeled is a peak flow
event or a low-flow event. |
distMeth |
Required for “GLS” and “GLSskew”. A value of
|
This function is largely a subroutine for WREG.GLS
.
The weighting matrix is calculated by iteration, as noted in the manual to
WREG v. 1.0. As currently implemented the initial estimate of model error
variance, GSQ
, is taken to range from 0
and 2*var(Y)
.
This interval is broken into 30 equally spaced intervals. The weighting
matrix is calculated for each interval endpoint and the deviation from
equation 21 in the WREG v. 1.0 manual is recorded. The progam then search
for the interval over which the deviatioon changes sign. This interval is
then split into 30 finer intervals and the process is repeated. The ine
interval with the smallest positive deviation is selected as the best
estimate.
This function returns a list with two elements:
GSQ |
The estimated model error variance. |
Omega |
The estimated weighting matrix. A square matrix. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Import some example data
peakFQdir <- paste0(
file.path(system.file("exampleDirectory", package = "WREG"),
"pfqImport"))
gisFilePath <- file.path(peakFQdir, "pfqSiteInfo.txt")
importedData <- importPeakFQ(pfqPath = peakFQdir, gisFile = gisFilePath)
# Organizing input data
lp3Data <- importedData$LP3f
lp3Data$K <- importedData$LP3k$AEP_0.5
Y <- importedData$Y$AEP_0.5
X <- importedData$X[c("Sand", "OutletElev", "Slope")]
# Compute weighting matrix
weightingResult <- Omega.GLS(alpha = 0.01, theta = 0.98,
independent = importedData$BasChars, X = X,
Y = Y, recordLengths = importedData$recLen,
LP3 = lp3Data, MSEGR = NA, TY = 20, peak = TRUE, distMeth = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.