Description Usage Arguments Details Value Examples
acf_by_group
takes a data frame with a grouping column and returns a
data frame with the autocorrelation values for each group.
1 2 | acf_by_group(.data, .group_var, .value_var, ..., .ci = c("none",
"white_noise", "ma"), .cl = 0.95)
|
.data |
the data frame the data is contained in |
.group_var |
the unquoted variable to be used as the grouping variable |
.value_var |
the name of the time series value to use |
... |
extra parameters to pass to the |
.ci |
the type of confidence interval to use, defaults to |
.cl |
confidence level for the confidence intervals, defaults to .95 |
Each row in the resulting data frame will refer to a group-lag auto-correlation value.
white_noise
will return confidence intervals for the series
assuming the autocorrelations come from a white noise distribution. ma
will apply the correction needed if the autocorrelations have some moving
average correlation.
a data frame with the acf values by group and lag
1 2 3 4 | pres_ratings <- data.frame(approval = as.numeric(presidents), pre_1965 = c(rep(1, 60), rep(0, 60)))
ratings_acf <- acf_by_group(pres_ratings[!is.na(pres_ratings$approval), ], pre_1965, approval)
## pass params to acf
ratings2_acf <- acf_by_group(pres_ratings, pre_1965, approval, na.action = na.pass)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.