sCurve | R Documentation |
Functions for transforming and back-transforming data using an s-shaped curve.
sCurve(x, location = 0, scale = 1, shape = 1) IsCurve(x, location = 0, scale = 1, shape = 1)
x |
a numeric vector to be transformed by |
location |
the transition point in the s-curve transform. |
scale |
the scaling factor for the data, the slope at the transition point in the s-curve transform. Must be greater than 0. |
shape |
a value that determines how quickly the curve approaches the limits of -1 or 1. Must be greater than 0. |
The basic equation for the s-curve is z/(1 + abs(z)^shape
)^(1/shape
),
where z is scale
*(x
-location
).
The function sCurve
computes the forward transform and the
function IsCurve
computes the inverse [sCurve] transform, or back-transform.
A numeric vector of the transformed or back-transformed values in
x
.
The sCurve
function is related to the hyperbolic
function in that both can represent mixing models for flow in stream water
chemistry. The sCurve
function is more flexible when there are
distinct upper and lower limits to the concentration. The hyperbolic
function is more flexible for open-ended concentrations for either high
or low flows. Also, sCurve
would typically use log-transformed
values for flow.
hyperbolic
## Not run: # Basic changes to the s-curve curve(sCurve(x), -5,5, ylim=c(-1,1)) # Shift to left curve(sCurve(x, location=1), -5,5, add=TRUE, col="red") # increase slope curve(sCurve(x, scale=2), -5,5, add=TRUE, col="cyan") # increase rate curve(sCurve(x, shape=2), -5,5, add=TRUE, col="purple") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.