plot_acf | R Documentation |
Calculate the autocorrelation function (ACF) for a time series of returns, and plot it.
plot_acf(
xtsv,
lagg = 10,
plotobj = TRUE,
xlab = "Lag",
ylab = "",
main = "",
...
)
xtsv |
A vector, matrix, or time series of returns. |
lagg |
The maximum lag at which to calculate the ACF (default is
|
plotobj |
A Boolean argument: should a plot be made?
(default is |
xlab |
A string with the x-axis label. |
ylab |
A string with the y-axis label. |
main |
A string with the plot title. |
... |
Additional arguments to the function |
The function plot_acf()
calculates the autocorrelation
function (ACF) for a time series of returns, and plots it. The function
plot_acf()
is just a wrapper for the function stats::acf()
.
The function stats::acf()
calculates the autocorrelation function,
including the lag zero autocorrelation, which is by definition equal to
1
.
The function plot_acf()
calls the function stats::acf()
,
removes the spurious lag zero autocorrelation, creates a plot, and returns
the ACF data invisibly.
Returns the ACF data invisibly and creates a plot.
# Plot the ACF of random returns
rutils::plot_acf(rnorm(1e4), lag=10, main="ACF of Random Returns")
# Plot the ACF of VTI returns
rutils::plot_acf(na.omit(rutils::etfenv$returns$VTI), lag=10, main="ACF of VTI Returns")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.