Description Usage Arguments Details Value Examples
Omega.WLS.ROImatchMatLab
calculates the weighting function
for a weighted least-squares regression using regions-of-influence. This is
largely legacy code to match WREG v. 1.05 idiosyncrasies.
1 | Omega.WLS.ROImatchMatLab(Y.all, X.all, LP3.all, RecordLengths.all, NDX)
|
Y.all |
The dependent variable of interest at all sites in the network, with any transformations already applied. |
X.all |
The independent variables at all sites in the network, with any
transformations already applied. Each row represents a site and each column
represents a particular independent variable. The rows must be in the same
order as the dependent variables in |
LP3.all |
A dataframe containing the fitted Log-Pearson Type III standard
deviate, standard deviation and skew for all sites in the network. The
names of this data frame are |
RecordLengths.all |
|
NDX |
A vector listing the indices of the sites that comprise the region of influence. |
This is a legacy function that matches the idiosyncrasies of WREG v. 1.05. This includes using all sites to implement the sigma regression, averaging across all record lengths, using arbitrary record lengths to estimate weights and using a new function for estimating the MSE of the basic OLS model.
This function will become obsolete once all idiosyncrasies are assessed.
Omega.WLS.ROImatchMatLab
returns a list with three elements:
Omega |
The estimated weighting matrix. |
var.modelerror.0 |
The estimated model error variance for a constant-value model. |
var.modelerror.k |
The estimated model error variance for a k-variable model. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # 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")]
#### Geographic Region-of-Influence
i <- 1 # Site of interest
n <- 10 # size of region of influence
Gdist <- vector(length=length(Y)) # Empty vector for geographic distances
for (j in 1:length(Y)) {
if (i!=j) {
#### Geographic distance
Gdist[j] <- Dist.WREG(Lat1 = importedData$BasChars$Lat[i],
Long1 = importedData$BasChars$Long[i],
Lat2 = importedData$BasChars$Lat[j],
Long2 = importedData$BasChars$Long[j]) # Intersite distance, miles
} else {
Gdist[j] <- Inf # To block self identification.
}
}
temp <- sort.int(Gdist,index.return=TRUE)
NDX <- temp$ix[1:n] # Sites to use in this regression
# Compute weighting matrix
weightingResult <- Omega.WLS.ROImatchMatLab(Y.all = Y, X.all = X,
LP3.all = lp3Data, RecordLengths.all = importedData$recLen, NDX = NDX)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.