acf.calc | R Documentation |

Calculates the autocorrelation function and draws the plots.

acf.calc(data.mat, lag = 50, plot = TRUE, title = NULL, details = FALSE)

`data.mat` |
matrix including the variables of which autocorrelations are calculated. |

`lag` |
lag at which the autocorrelation is calculated, default is set as 50. |

`plot` |
logical variable to specify whether the plot is generated, default is set to TRUE. |

`title` |
title of each generated autocorrelation plot. |

`details` |
boolean variable to specify whether the autocorrelation values are returned, default is set to FALSE. |

This function calculates the autocorrelations of all the variables on a column by column base.
The default value of `lag`

is set as 50, the maximum number of lag should not exceed the number of rows of the dataset,
which reflects the corresponding number of iteration of running the multiple imputation.

If `details`

= TRUE, a matrix containing the calculated autocorrelations of all the variables in the dataset will be returned.
If `plot`

= TRUE, the autocorrelation plots of all the variables will be drawn.

### generate some data dat <- MASS::mvrnorm(n = 1000, mu = c(1, 2, 3, 4), Sigma = diag(4)) ### ACF plots acf.calc(data.mat = dat, title = paste0("Var ", 1:nrow(dat)))

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.