regEquation: Print Resulting Regresstion String

Description Usage Arguments Details Value Examples

View source: R/regEquation.R

Description

The regEquation function takes a WREG object and returns the equation string.

Usage

1
regEquation(object, decimals = 2)

Arguments

object

The dependent variable of interest, with any transformations already applied.

decimals

An integer or vector of integers specifying how many decimal places should be used for each coefficient. If provided as a vector that does not match the number of rows in object$Coefs, then the first number provided will be replicated for all coefficients.

Details

This function is used via a the print command, but can also be used by itself.

Value

A character string using the estimated coefficients and the coefficient names from the object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 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")]
X <- cbind(data.frame("Intercept" = rep(1, nrow(X))), X)
transY <- "none"
result <- WREG.OLS(Y, X, transY)
print(regEquation(result))

wfarmer-usgs/WREG documentation built on July 24, 2020, 1:28 a.m.