acf.summary: acf.summary

Description Usage Arguments Examples

View source: R/block-glm.R

Description

summarize the autocorrelation in

Usage

1
acf.summary(data, variables, order.by = NULL, lag.max = 100)

Arguments

data

data.table containing variables named in 'variables' and 'order.by'

variables

character vector listing columns of 'data' to be explored for autocorrelation

order.by

optionally, order 'data' by variables in character vector 'order.by'

lag.max

maximum block size to explore (default=100)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## simulate data with 10 repeated observations in a row - ie there
## should be autocorrelation only within windows <= 10
library(data.table)
data <- genomic.autocorr:::.sim.data() 
summ <- acf.summary(data,c("x","y0","y1"),lag.max=20)

## plot it
df <- melt(summ,c("lag","variable"),variable.name="acf")
par(mfrow=c(2,1))
matplot(matrix(df[acf=="full",]$value,ncol=3),
        main="full",
        pch=c("x","o","+"),
        type="b")
abline(h=0,lty=2)
legend("bottomright",
       c("x","y0","y1"),
       pch = "xo+", col = 1:3)
matplot(matrix(df[acf=="partial",]$value,ncol=3),
        main="partial",
        pch=c("x","o","+"),
        type="b")
abline(h=0,lty=2)
legend("bottomright",
       c("x","y0","y1"),
       pch = "xo+", col = 1:3)

genomic.autocorr documentation built on May 1, 2019, 8:48 p.m.