Influence: Influence Statistics (Cook's D) (WREG)

Description Usage Arguments Details Value Examples

Description

The Influence function calculates the influence statistics (Cooks-D) for any regrerssion.

Usage

1
Influence(e, X, Omega, Beta, ROI = FALSE, Lev = NA)

Arguments

e

contains the model residuals.

X

contains independent variables. A leading constant of one is included if a constant is included in the regression. Each row represents a unique obsevation.

Omega

is the weighting matrix used for regression fitting.

Beta

contains the fitted model coefficients.

ROI

is a logical indicating if this is a region-of-influence regression.

Lev

is a vector with the same length as e and includes the leverage of each observation. This input is required for any region-of-influence regression.

Details

Influence is a measure of the impact each observation has on the estimated regression coefficients. The calculation is based on equation 43 of the WREG v. 1.0 manual. The critical value of influence is calculated using equation 44. An influence is considered significant if the absolute value of the influence is greater than the critical value.

For region-of-influence regressions, the influence calculation is weighted by the leverage of that observation on the target site and the overall leverage of the observation. This is a departure from the WREG v. 1.0, but reflects the WREG v. 1.05 code.

Value

The function returns as list as output. The list contains:

Influence

A vector containing the influence (Cook's D) of each observation on the estimated regression coefficients.

Limit

The critical influence value for this dataset.

Significant

A logical vector the same size as Influence. It indicates if the influence is significant for each observation.

Examples

 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("Sand", "OutletElev", "Slope")]
transY <- "none"
result <- WREG.OLS(Y, X, transY)

# calculate influence of each point
influenceResult <- Influence(e = result$residuals, X = X, 
  Omega = result$Weighting, Beta = result$Coefs$Coefficient)

USGS-R/WREG documentation built on May 9, 2019, 6:48 p.m.