Description Usage Arguments Details Value Examples
Flexible generalized logistic function.
1 2 |
X |
A numeric vector. |
x0 |
optional: The value(s) where |
x1 |
optional: The value(s) where |
p |
optional: A percent of |
b |
optional: A positive valued rate at which |
type |
optional: A character value accepting |
plotpenalty |
If |
allowed.error |
The allowed difference between |
invert |
If |
The parameter arguments (i.e., the arguements required to parametrize glpenalty
) are x0
, x1
, p
, b
, and side
. Only certian combinations of these parameter arguments are required. If more than the needed number of parameter arguments are given, then glpenalty
will use only the first two supplied. The following combinations of parameter arguments are accepted:
1. {x0,x1}
: The function will grow (if x0 < x1
) or decay (if x0 > x1
) between the supplied values. For both growth and decay, supply 2 values to both x0 and x1
where x0[1]
<
x1[1]
<
x1[2]
<
x0[2]
.
2. {x1,b,side}
: The function will grow or decay starting at x1
and at rate b
.
3. {p,b,side}
: The function will grow or decay starting at p
percent of the vector X
and at rate b
.
Returns the numeric penalty vector.
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 35 | # create a vector of numbers
x = seq.int(1,100)
# specify x near 0 (x0) and x near 1 (x1), growth is computed
glpenalty(x,x0 = 20,x1 = 50)
#How the plot might look when numbers aren't consecutive
glpenalty(sort(sample(x,40)),x0 = 20,x1 = 50)
# decay when x near 0 (x0) is greater than x near 1 (x1)
glpenalty(x,x0 = 50,x1 = 20)
# adjust shrink allowed.error at x0 and x1. Smaller allowed.error
# makes for "steeper" rates of growth or decay.
glpenalty(x,x0 = 50,x1 = 20,allowed.error = 0.0001)
# combine growth and decay by specifying 2 x0 and 2 x1
# growth from 10 to 35 and decay from 50 to 90.
glpenalty(x,x0 = c(10,90),x1 = c(35,50))
# invert
glpenalty(x,x0 = c(10,90),x1 = c(35,50),invert=TRUE)
# specify x1 and growth rate.
glpenalty(x,x1 = 30,b = 0.4, type = "growth")
glpenalty(x,x1 = 20,b = 0.5, type = "decay")
glpenalty(x,x1 = 30,b = 0.3, type = "both")
# specify percent of vector to be penalized
# and growth rate.
glpenalty(x,p = 0.6,b = 0.4, type = "growth")
glpenalty(x,p = 0.6,b = 0.5, type = "decay")
glpenalty(x,p = 0.4,b = 0.3, type = "both")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.