View source: R/transfer-entropy.R
| prewhiten_bin_glm | R Documentation |
Fits a logistic regression (binomial GLM with logit link) to a binary 0/1 response and returns Pearson residuals as a pre-whitened series.
prewhiten_bin_glm(DT, yname)
DT |
A
|
yname |
Character scalar; name of the binary response column in
|
A numeric vector of Pearson residuals (one per row in DT
used in the fit).
if (interactive()) {
n <- 100
DT <- data.frame(
t_norm = seq_len(n) / n,
I_zero = rbinom(n, 1, 0.3),
Regime = factor(sample(c("A","B"), n, TRUE)),
EconCycle = rnorm(n), PopDensity = runif(n),
Epidemics = rbinom(n, 1, 0.1), Climate = rnorm(n), War = rbinom(n, 1, 0.05)
)
r_I_zero <- prewhiten_bin_glm(DT, "I_zero")
head(r_I_zero)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.