Standard deviation of lag-01 autocorrelation

How can I estimate the standard deviation of autocorrelation (lag-01) for each month in a time series.
I am inserting the following dataset.
THanks



id <- "146Ng_b6wCcVNAVGwpej68yAkguZPHBak"
data=read_csv(paste0("https://docs.google.com/uc?id=",id,"&export=download"),
              col_names = TRUE)
data=data %>% 
  mutate(month=month(datetime))
head(data)


data_month=function(mon){
  lag01=data %>% 
    filter(month==mon)
  return(lag01)
}

jan=data_month(mon=1)




The standard deviation of the rain column, if that's what you are looking for, will be virtually (within floating point error for a vector this size) identical, because the rain_diff_1 vector will be identical to the rain vector with the sole difference that rain_diff_1[1] will be NA.

Update: what was I thinking? They are only closely similar. For a statistic to evaluate the degree to which a differenced series is still autocorrleated, consider the Ljung-Box test described in Hyndman

suppressPackageStartupMessages({
  library(fpp3)

})
id <- "146Ng_b6wCcVNAVGwpej68yAkguZPHBak"
Data <- readr::read_csv(paste0("https://docs.google.com/uc?id=", id, "&export=download"),
  col_names = TRUE
)
#> 
#> ── Column specification ────────────────────────────────────────────────────────
#> cols(
#>   datetime = col_datetime(format = ""),
#>   rain = col_double()
#> )


rain <- Data[,2][[1]]
rain_diff <- diff(rain)

sd(rain)
#> [1] 0.4578699
sd(rain_diff)
#> [1] 0.4861607

sd(rain) - sd(rain_diff)
#> [1] -0.02829075
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.