calc_logistic_regression {HyMETT} | R Documentation |
Calculate logistic regression in annual statistics with zero values
Description
Calculate logistic regression (Everitt and Hothorn, 2009) in annual statistics with zero values. A model fit to compute the probability of a zero flow annual statistic.
Usage
calc_logistic_regression(data = NULL, year, value, ...)
Arguments
data |
'data.frame'. Optional data.frame input, with columns containing |
year |
'numeric' vector when |
value |
'numeric' vector when |
... |
further arguments to be passed to or from |
Details
This function is a wrapper for stats::glm(y ~ year, family = stats::binomial(link="logit")
with y = 1
when value = 0
(for example a zero flow annual statistic) and y = 0
otherwise.
The returned values include
p_value
Probability value of the explanatory (
year
) variable in the logistic modelstdErr_slope
Standard error of the regression slope (log odds per year)
odds_ratio
Exponential of the explanatory coefficient (year coefficient)
prob_beg/end
Logistic regression predicted (fitted) values at the beginning and ending year.
prob_change
Change in probability from beginning to end.
Example, an odds ratio of 1.05 represents the odds of a zero-flow year (versus non-zero) increase by a factor of 1.05 (or 5 percent).
Value
A tibble (see tibble::tibble
) with logistic regression p-value, standard error of
slope, odds ratio, beginning and ending probability, and probability change. See Details.
References
Everitt, B. S. and Hothorn T., 2009, A Handbook of Statistical Analyses Using R, 2nd Ed. Boca Raton, Florida, Chapman and Hall/CRC, 376p.
See Also
Examples
calc_logistic_regression(data = example_annual, year = "WY", value = "annual_mean")