Usage Arguments Details Author(s) Examples
1 2 3 4 |
x |
A numeric vector containing the data |
k |
An estimate of the the shape parameter |
sensitivity |
How precise should the estimate be |
bias.correct |
Should bias correction be performed on the result (see details) |
neg |
What to do if the MLE calculation encounters a negative value (see details) |
... |
Additional arguments to be passed to and from other functions |
Data that follow a gamma distribution must be positive. When attempting to calculate the maximum likelihood estimate of the shape parameter of a dataset containing negative values an error will occur. The 'neg' argument allows the user to choose how to handle this situation. Setting 'neg' to "remove" will remove any value less than or equal to 0 before attempting the calculation. Setting 'neg' to "small" will replace any value less than or equal to 0 with the smallest positve number available on the system. Setting 'neg' to any numeric value will cause values less than or equal to 0 to be replaced with that value. Setting 'neg' to any other value will cause the function to stop with an error (the default behavior).
<There needs to be a brief explanation of the bias correction equation and a reference to the Tech Guide.>
Eric Bailey <ebailey@idem.in.gov>
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 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x, k, neg = "stop", ...)
{
if (min(x) <= 0) {
if (neg == "remove") {
x <- x[x > 0]
}
else if (neg == "small") {
x[x <= 0] <- .Machine$double.eps
}
else if (is.numeric(neg)) {
x[x <= 0] <- neg
}
else {
stop("gamma distributed data cannot contain negative numbers")
}
}
if (missing(k))
k <- gshape(x, ...)
sum(x)/length(x)/k
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.