Description Usage Arguments Details Value Examples
WREG.ROI
implements region-of-influence regression in the
WREG framework.
1 2 3 4 |
Y |
The dependent variable of interest, with any transformations already applied. |
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 |
Reg |
A string indicating which type of regression should be applied. The options include: “OLS” for ordinary least-squares regression, “WLS” for weighted least-squares regression, “GLS” for generalized least-squares regression, with no uncertainty in regional skew and “GLSskew” for generalized least-squares regression with uncertainty in regional skew. (In the case of “GLSskew”, the uncertainty in regional skew must be provided as the mean squared error in regional skew.) |
transY |
A required character string indicating if the the dependentvariable was transformed by the common logarithm ('log10'), transformed by the natural logarithm ('ln') or untransformed ('none'). |
recordLengths |
This input is required for “WLS”, “GLS” and
“GLSskew”. For “GLS” and “GLSskew”,
|
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 |
regSkew |
A logical vector indicating if regional skews are provided with
an adjustment required for uncertainty therein ( |
alpha |
A number, required only for “GLS” and “GLSskew”.
|
theta |
A number, required only for “GLS” and “GLSskew”.
|
BasinChars |
A dataframe containing three variables: |
MSEGR |
A number. The mean squared error of the regional skew. |
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. |
ROI |
A string indicating how to define the region of influence. “PRoI” signifies physiographic, independent or predictor-variable region of influence. “GRoI” calls for a geographic region of influence. “HRoI” requests a hybrid region of influence. Details on each approach are provided in the manual for WREG v. 1.0. |
n |
The number of sites to include in the region of influence. |
D |
Required for “HRoI”, the geographic limit within which to
search for a physiographic region of influence. In WREG v. 1.05 (see
|
DistMeth |
Required for “GLS” and “GLSskew”. A value of
|
Legacy |
A logical. A value of |
The support for region-of-influence regression is described in the
manual of WREG v. 1.0. WREG.RoI
iterates through the sites of
Y
, defines a region of influence and implements the specified
regression by calling a WREG function.
The logical handle Legacy
has been included to test that this program
returns the same results as WREG v. 1.05. In the development of this code,
some idiosyncrasies of the MatLab code for WREG v. 1.05 became apparent.
Setting Legacy
equal to TRUE
forces the code to use the same
idiosycrasies as WREG v. 1.05. Some of these idosyncrasies may be bugs in
the code. Further analysis is needed. For information on the specific
idiosyncrasies, see the notes for the Legacy
input and the links to
other functions in this package.
As with other WREG functions, WREG.RoI
returns a large list
of regression parameters and metrics. This list varies depending on the
Reg
specified, but may contain:
fitted.values |
A vector of model estimates from the regression model. |
residuals |
A vector of model residuals. |
PerformanceMetrics |
A list of four elements. These
represent approximate performance regression across all of the
region-of-influence regressions. These include the mean squared error of
residuals ( |
Coefficients |
A list composed of four elements: (1) |
ROI.Regressions |
A list of elements and outputs from each
individual ROI regression. These include a matrix of the sites used in each
ROI regression ( |
ROI.InputParameters |
A list of input parameters to record
the controls on the ROI regression. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # 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)
# Run a simple regression
Y <- importedData$Y$AEP_0.5
X <- importedData$X[c("A")]
transY <- "none"
basinChars <- importedData$BasChars
#result <- WREG.OLS(Y, X, transY)
result <- WREG.RoI(Y, X, Reg = "OLS", transY, BasinChars = basinChars,
ROI='GRoI', n = 10L)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.